aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornenolod@dereferenced.org <William Pitcock>2018-04-19 12:29:35 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-04-19 07:45:09 -0500
commitf08f9d449811d7a67b5c901889b0fef2e9ab8da9 (patch)
treea01a7d26f1c13b4820765f28c0452207902c9d96
parentd24ddd9fb9fb5254b2e80cbe70ba9bc83f2cd0da (diff)
downloadpleroma-f08f9d449811d7a67b5c901889b0fef2e9ab8da9.tar.gz
ActivityPub MRF: fix nsfw tagging of objects with attachments by looking at the right object (the child in this case)
-rw-r--r--lib/pleroma/web/activity_pub/mrf/simple_policy.ex10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex
index 1322744f1..cb8eaf1ec 100644
--- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex
@@ -23,10 +23,12 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
@media_nsfw Keyword.get(@mrf_policy, :media_nsfw)
defp check_media_nsfw(actor_info, object) do
- if actor_info.host in @media_nsfw and object["attachment"] != nil and length(object["attachment"]) > 0 do
- tags = (object["tag"] || []) ++ ["nsfw"]
- object = Map.put(object, "tags", tags)
- object = Map.put(object, "sensitive", true)
+ child_object = object["object"]
+ if actor_info.host in @media_nsfw and child_object["attachment"] != nil and length(child_object["attachment"]) > 0 do
+ tags = (child_object["tag"] || []) ++ ["nsfw"]
+ child_object = Map.put(child_object, "tags", tags)
+ child_object = Map.put(child_object, "sensitive", true)
+ object = Map.put(object, "object", child_object)
end
{:ok, object}