Don't return html in the text field.
authorRoger Braun <roger@rogerbraun.net>
Wed, 12 Apr 2017 15:22:29 +0000 (17:22 +0200)
committerRoger Braun <roger@rogerbraun.net>
Wed, 12 Apr 2017 15:22:29 +0000 (17:22 +0200)
lib/pleroma/web/twitter_api/representers/activity_representer.ex
test/web/twitter_api/representers/activity_representer_test.exs

index 5fe0df359f0a772d07bc61cf3f7f84a97bbd3f15..b0dd85bbb77870c01d2a94df661e2bb6266f8bff 100644 (file)
@@ -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,
index 256d920c0b2f2d862ee455dc277c393914b83cbe..6b0da810fcbcf7dda9697c8710fbdca89a4ffdef 100644 (file)
@@ -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,