diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex index 929e26bf0..3fbeb86ba 100644 --- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex @@ -135,6 +135,12 @@ def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = ac tags = activity.data["object"]["tag"] || [] possibly_sensitive = Enum.member?(tags, "nsfw") + content = if activity.data["object"]["summary"] do + "#{activity.data["object"]["summary"]}
#{content}" + else + content + end + html = HtmlSanitizeEx.basic_html(content) |> Formatter.emojify(object["emoji"]) %{ diff --git a/test/web/twitter_api/representers/activity_representer_test.exs b/test/web/twitter_api/representers/activity_representer_test.exs index f08644611..7e2ea630c 100644 --- a/test/web/twitter_api/representers/activity_representer_test.exs +++ b/test/web/twitter_api/representers/activity_representer_test.exs @@ -91,6 +91,7 @@ test "an activity" do "published" => date, "type" => "Note", "content" => content_html, + "summary" => "2hu", "inReplyToStatusId" => 213123, "attachment" => [ object @@ -110,14 +111,14 @@ test "an activity" do local: false } - expected_html = "alert('YAY')Some 2hu content mentioning @shp" + expected_html = "2hu
alert('YAY')Some 2hu content mentioning @shp" expected_status = %{ "id" => activity.id, "user" => UserView.render("show.json", %{user: user, for: follower}), "is_local" => false, "statusnet_html" => expected_html, - "text" => content, + "text" => "2hu" <> content, "is_post_verb" => true, "created_at" => "Tue May 24 13:26:08 +0000 2016", "in_reply_to_status_id" => 213123,