Skip to content
Snippets Groups Projects
Commit b41f3eff authored by lain's avatar lain
Browse files

Preserve newlines in messages.

parent ca4d7f46
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,7 @@ def create_status(user = %User{}, data = %{}) do
context = ActivityPub.generate_context_id
content = HtmlSanitizeEx.strip_tags(data["status"])
|> String.replace("\n", "<br>")
mentions = parse_mentions(content)
......
......@@ -27,13 +27,13 @@ test "create a status" do
object = Repo.insert!(%Object{data: object_data})
input = %{
"status" => "Hello again, @shp.<script></script>",
"status" => "Hello again, @shp.<script></script>\nThis is on another line.",
"media_ids" => [object.id]
}
{ :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input)
assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>."
assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>This is on another line."
assert get_in(activity.data, ["object", "type"]) == "Note"
assert get_in(activity.data, ["object", "actor"]) == user.ap_id
assert get_in(activity.data, ["actor"]) == user.ap_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment