Preserve newlines in messages.
This commit is contained in:
parent
ca4d7f4607
commit
b41f3eff84
@ -13,6 +13,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
|||||||
context = ActivityPub.generate_context_id
|
context = ActivityPub.generate_context_id
|
||||||
|
|
||||||
content = HtmlSanitizeEx.strip_tags(data["status"])
|
content = HtmlSanitizeEx.strip_tags(data["status"])
|
||||||
|
|> String.replace("\n", "<br>")
|
||||||
|
|
||||||
mentions = parse_mentions(content)
|
mentions = parse_mentions(content)
|
||||||
|
|
||||||
|
@ -27,13 +27,13 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
|||||||
object = Repo.insert!(%Object{data: object_data})
|
object = Repo.insert!(%Object{data: object_data})
|
||||||
|
|
||||||
input = %{
|
input = %{
|
||||||
"status" => "Hello again, @shp.<script></script>",
|
"status" => "Hello again, @shp.<script></script>\nThis is on another line.",
|
||||||
"media_ids" => [object.id]
|
"media_ids" => [object.id]
|
||||||
}
|
}
|
||||||
|
|
||||||
{ :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input)
|
{ :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", "type"]) == "Note"
|
||||||
assert get_in(activity.data, ["object", "actor"]) == user.ap_id
|
assert get_in(activity.data, ["object", "actor"]) == user.ap_id
|
||||||
assert get_in(activity.data, ["actor"]) == user.ap_id
|
assert get_in(activity.data, ["actor"]) == user.ap_id
|
||||||
|
Loading…
Reference in New Issue
Block a user