Keep newlines around.
This commit is contained in:
parent
a92a9dce94
commit
48f9df2391
3 changed files with 5 additions and 5 deletions
|
@ -14,13 +14,13 @@ defmodule Pleroma.Web.TwitterAPI.Utils do
|
||||||
"<a href='#{href}' class='attachment'>#{Path.basename(href)}</a>"
|
"<a href='#{href}' class='attachment'>#{Path.basename(href)}</a>"
|
||||||
_ -> ""
|
_ -> ""
|
||||||
end)
|
end)
|
||||||
Enum.join([text | attachment_text], "<br>")
|
Enum.join([text | attachment_text], "<br>\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_input(text, mentions) do
|
def format_input(text, mentions) do
|
||||||
HtmlSanitizeEx.strip_tags(text)
|
HtmlSanitizeEx.strip_tags(text)
|
||||||
|> Formatter.linkify
|
|> Formatter.linkify
|
||||||
|> String.replace("\n", "<br>")
|
|> String.replace("\n", "<br>\n")
|
||||||
|> add_user_links(mentions)
|
|> add_user_links(mentions)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content_html = "Some #content mentioning <a href='#{mentioned_user.ap_id}'>@shp</shp>"
|
content_html = "Some #content #mentioning <a href='#{mentioned_user.ap_id}'>@shp</shp>"
|
||||||
content = HtmlSanitizeEx.strip_tags(content_html)
|
content = HtmlSanitizeEx.strip_tags(content_html)
|
||||||
date = DateTime.from_naive!(~N[2016-05-24 13:26:08.003], "Etc/UTC") |> DateTime.to_iso8601
|
date = DateTime.from_naive!(~N[2016-05-24 13:26:08.003], "Etc/UTC") |> DateTime.to_iso8601
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do
|
||||||
"like_count" => 5,
|
"like_count" => 5,
|
||||||
"announcement_count" => 3,
|
"announcement_count" => 3,
|
||||||
"context" => "2hu",
|
"context" => "2hu",
|
||||||
"tag" => ["nsfw", "content"]
|
"tag" => ["content", "mentioning", "nsfw"]
|
||||||
},
|
},
|
||||||
"published" => date,
|
"published" => date,
|
||||||
"context" => "2hu"
|
"context" => "2hu"
|
||||||
|
|
|
@ -34,7 +34,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
|
||||||
|
|
||||||
{ :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>.<br>This is on another line. #2hu #epic #phantasmagoric<br><a href='http://example.org/image.jpg' class='attachment'>image.jpg</a>"
|
assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>\nThis is on another line. #2hu #epic #phantasmagoric<br>\n<a href='http://example.org/image.jpg' class='attachment'>image.jpg</a>"
|
||||||
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 a new issue