From 48f9df2391557db6a9f9dae37b9d39d6cd5f612a Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 18 May 2017 16:41:16 +0200 Subject: [PATCH] Keep newlines around. --- lib/pleroma/web/twitter_api/utils.ex | 4 ++-- .../twitter_api/representers/activity_representer_test.exs | 4 ++-- test/web/twitter_api/twitter_api_test.exs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/twitter_api/utils.ex b/lib/pleroma/web/twitter_api/utils.ex index b7078b9c6..82e3620f2 100644 --- a/lib/pleroma/web/twitter_api/utils.ex +++ b/lib/pleroma/web/twitter_api/utils.ex @@ -14,13 +14,13 @@ defmodule Pleroma.Web.TwitterAPI.Utils do "#{Path.basename(href)}" _ -> "" end) - Enum.join([text | attachment_text], "
") + Enum.join([text | attachment_text], "
\n") end def format_input(text, mentions) do HtmlSanitizeEx.strip_tags(text) |> Formatter.linkify - |> String.replace("\n", "
") + |> String.replace("\n", "
\n") |> add_user_links(mentions) end diff --git a/test/web/twitter_api/representers/activity_representer_test.exs b/test/web/twitter_api/representers/activity_representer_test.exs index e3d88e74f..dce6025c4 100644 --- a/test/web/twitter_api/representers/activity_representer_test.exs +++ b/test/web/twitter_api/representers/activity_representer_test.exs @@ -67,7 +67,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do } } - content_html = "Some #content mentioning @shp" + content_html = "Some #content #mentioning @shp" content = HtmlSanitizeEx.strip_tags(content_html) 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, "announcement_count" => 3, "context" => "2hu", - "tag" => ["nsfw", "content"] + "tag" => ["content", "mentioning", "nsfw"] }, "published" => date, "context" => "2hu" diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 3b6a7a1fe..4df1aba9e 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -34,7 +34,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do { :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input) - assert get_in(activity.data, ["object", "content"]) == "Hello again, @shp.
This is on another line. #2hu #epic #phantasmagoric
image.jpg" + assert get_in(activity.data, ["object", "content"]) == "Hello again, @shp.
\nThis is on another line. #2hu #epic #phantasmagoric
\nimage.jpg" 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