mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-29 19:05:19 +01:00
ActivityPub MRF: fix nsfw tagging of objects with attachments by looking at the right object (the child in this case)
This commit is contained in:
parent
d24ddd9fb9
commit
f08f9d4498
@ -23,10 +23,12 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do
|
|||||||
|
|
||||||
@media_nsfw Keyword.get(@mrf_policy, :media_nsfw)
|
@media_nsfw Keyword.get(@mrf_policy, :media_nsfw)
|
||||||
defp check_media_nsfw(actor_info, object) do
|
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
|
child_object = object["object"]
|
||||||
tags = (object["tag"] || []) ++ ["nsfw"]
|
if actor_info.host in @media_nsfw and child_object["attachment"] != nil and length(child_object["attachment"]) > 0 do
|
||||||
object = Map.put(object, "tags", tags)
|
tags = (child_object["tag"] || []) ++ ["nsfw"]
|
||||||
object = Map.put(object, "sensitive", true)
|
child_object = Map.put(child_object, "tags", tags)
|
||||||
|
child_object = Map.put(child_object, "sensitive", true)
|
||||||
|
object = Map.put(object, "object", child_object)
|
||||||
end
|
end
|
||||||
|
|
||||||
{:ok, object}
|
{:ok, object}
|
||||||
|
Loading…
Reference in New Issue
Block a user