diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-04-12 17:22:29 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-04-12 17:22:29 +0200 |
commit | 1b086834bd83a490e55d44ffa5167c8856db92d9 (patch) | |
tree | cfc566072559fc1edc2fbb6075c3c1f5fba57df6 | |
parent | b666f11d2fc32b10dce0d36e72cc285377c28f18 (diff) | |
download | pleroma-1b086834bd83a490e55d44ffa5167c8856db92d9.tar.gz pleroma-1b086834bd83a490e55d44ffa5167c8856db92d9.zip |
Don't return html in the text field.
-rw-r--r-- | lib/pleroma/web/twitter_api/representers/activity_representer.ex | 2 | ||||
-rw-r--r-- | test/web/twitter_api/representers/activity_representer_test.exs | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex index 5fe0df359..b0dd85bbb 100644 --- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex @@ -33,7 +33,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do "user" => UserRepresenter.to_map(user, opts), "attentions" => [], "statusnet_html" => content, - "text" => content, + "text" => HtmlSanitizeEx.strip_tags(content), "is_local" => true, "is_post_verb" => true, "created_at" => published, diff --git a/test/web/twitter_api/representers/activity_representer_test.exs b/test/web/twitter_api/representers/activity_representer_test.exs index 256d920c0..6b0da810f 100644 --- a/test/web/twitter_api/representers/activity_representer_test.exs +++ b/test/web/twitter_api/representers/activity_representer_test.exs @@ -23,7 +23,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do } } - content = "Some content mentioning @shp" + content_html = "Some content mentioning <a href='shp'>@shp</shp>" + content = HtmlSanitizeEx.strip_tags(content_html) date = DateTime.utc_now() |> DateTime.to_iso8601 activity = %Activity{ @@ -39,7 +40,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do "object" => %{ "published" => date, "type" => "Note", - "content" => content, + "content" => content_html, "inReplyToStatusId" => 213123, "statusnetConversationId" => 4711, "attachment" => [ @@ -56,7 +57,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do "user" => UserRepresenter.to_map(user, %{for: follower}), "is_local" => true, "attentions" => [], - "statusnet_html" => content, + "statusnet_html" => content_html, "text" => content, "is_post_verb" => true, "created_at" => date, |