forked from AkkomaGang/akkoma
Merge branch 'patch-bio' into 'develop'
replace newlines in profiles with <br> See merge request pleroma/pleroma!136
This commit is contained in:
commit
b7584edcea
2 changed files with 18 additions and 1 deletions
|
@ -347,7 +347,8 @@ def empty_array(conn, _params) do
|
|||
def update_profile(%{assigns: %{user: user}} = conn, params) do
|
||||
params =
|
||||
if bio = params["description"] do
|
||||
Map.put(params, "bio", bio)
|
||||
bio_brs = Regex.replace(~r/\r?\n/,bio,"<br>")
|
||||
Map.put(params, "bio", bio_brs)
|
||||
else
|
||||
params
|
||||
end
|
||||
|
|
|
@ -784,4 +784,20 @@ test "it returns the tags timeline", %{conn: conn} do
|
|||
assert status["id"] == activity.id
|
||||
end
|
||||
end
|
||||
|
||||
test "Convert newlines to <br> in bio", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/account/update_profile.json", %{
|
||||
"description" => "Hello,\r\nWorld! I\n am a test."
|
||||
})
|
||||
|
||||
user = Repo.get!(User, user.id)
|
||||
assert user.bio == "Hello,<br>World! I<br> am a test."
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue