twitter api: add support for user-specified html policy
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 22 Sep 2018 02:13:54 +0000 (02:13 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 22 Sep 2018 02:53:01 +0000 (02:53 +0000)
lib/pleroma/web/twitter_api/representers/activity_representer.ex
lib/pleroma/web/twitter_api/views/activity_view.ex
lib/pleroma/web/twitter_api/views/user_view.ex

index 5c4eed671bf7d87b32145a24ad5e9024f9d62bc3..b21bbb205f6553113536ed7016d1137a76a30487 100644 (file)
@@ -168,7 +168,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
     {summary, content} = ActivityView.render_content(object)
 
     html =
-      HTML.filter_tags(content)
+      HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
       |> Formatter.emojify(object["emoji"])
 
     video =
index 666a35a24cfccd9b53144e0e48b01d84eca40bd5..b9fd062d6fa6a257f6b548827c645a890b149a0e 100644 (file)
@@ -233,7 +233,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
     {summary, content} = render_content(object)
 
     html =
-      HTML.filter_tags(content)
+      HTML.filter_tags(content, User.html_filter_policy(opts[:for]))
       |> Formatter.emojify(object["emoji"])
 
     %{
index f2641047f3a860bfdbef831adf1bce535228242a..cec9e11a06d1f384e4427d8502fb7e68260b5278 100644 (file)
@@ -40,7 +40,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
     data = %{
       "created_at" => user.inserted_at |> Utils.format_naive_asctime(),
       "description" => HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
-      "description_html" => HTML.filter_tags(user.bio),
+      "description_html" => HTML.filter_tags(user.bio, User.html_filter_policy(assigns[:for])),
       "favourites_count" => 0,
       "followers_count" => user_info[:follower_count],
       "following" => following,