Keep newlines around.
authorRoger Braun <roger@rogerbraun.net>
Thu, 18 May 2017 14:41:16 +0000 (16:41 +0200)
committerRoger Braun <roger@rogerbraun.net>
Thu, 18 May 2017 14:41:16 +0000 (16:41 +0200)
lib/pleroma/web/twitter_api/utils.ex
test/web/twitter_api/representers/activity_representer_test.exs
test/web/twitter_api/twitter_api_test.exs

index b7078b9c6456acbfe5182a2f63ebc9418b23281b..82e3620f2a38e6d31e1de6785923335617399037 100644 (file)
@@ -14,13 +14,13 @@ defmodule Pleroma.Web.TwitterAPI.Utils do
         "<a href='#{href}' class='attachment'>#{Path.basename(href)}</a>"
       _ -> ""
     end)
-    Enum.join([text | attachment_text], "<br>")
+    Enum.join([text | attachment_text], "<br>\n")
   end
 
   def format_input(text, mentions) do
     HtmlSanitizeEx.strip_tags(text)
     |> Formatter.linkify
-    |> String.replace("\n", "<br>")
+    |> String.replace("\n", "<br>\n")
     |> add_user_links(mentions)
   end
 
index e3d88e74f82cc024a5552ae47419018b045a25c7..dce6025c4d4bf4fb797c083cee0453005b968c39 100644 (file)
@@ -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)
     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"
index 3b6a7a1fe5fdadc7711b8d068161cb9b40dbeebc..4df1aba9eb1f88b37466745dcc36a5bec631049c 100644 (file)
@@ -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, <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", "actor"]) == user.ap_id
     assert get_in(activity.data, ["actor"]) == user.ap_id