Fix format.
This commit is contained in:
parent
b7584edcea
commit
bc215f5684
|
@ -347,7 +347,7 @@ def empty_array(conn, _params) do
|
||||||
def update_profile(%{assigns: %{user: user}} = conn, params) do
|
def update_profile(%{assigns: %{user: user}} = conn, params) do
|
||||||
params =
|
params =
|
||||||
if bio = params["description"] do
|
if bio = params["description"] do
|
||||||
bio_brs = Regex.replace(~r/\r?\n/,bio,"<br>")
|
bio_brs = Regex.replace(~r/\r?\n/, bio, "<br>")
|
||||||
Map.put(params, "bio", bio_brs)
|
Map.put(params, "bio", bio_brs)
|
||||||
else
|
else
|
||||||
params
|
params
|
||||||
|
|
|
@ -786,18 +786,16 @@ test "it returns the tags timeline", %{conn: conn} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "Convert newlines to <br> in bio", %{conn: conn} do
|
test "Convert newlines to <br> in bio", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/account/update_profile.json", %{
|
|> post("/api/account/update_profile.json", %{
|
||||||
"description" => "Hello,\r\nWorld! I\n am a test."
|
"description" => "Hello,\r\nWorld! I\n am a test."
|
||||||
})
|
})
|
||||||
|
|
||||||
user = Repo.get!(User, user.id)
|
user = Repo.get!(User, user.id)
|
||||||
assert user.bio == "Hello,<br>World! I<br> am a test."
|
assert user.bio == "Hello,<br>World! I<br> am a test."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue