diff options
author | tusooa <tusooa@kazv.moe> | 2022-12-15 11:08:24 -0500 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2022-12-15 11:08:24 -0500 |
commit | dc7efcd08b822e84e893775084d3b35288462264 (patch) | |
tree | 2e23183eb97332f7665e24a48d74c56442b2bb45 /lib | |
parent | 204fd6faae8c39706a5ded42c7cc4fbc71a733bc (diff) | |
download | pleroma-dc7efcd08b822e84e893775084d3b35288462264.tar.gz pleroma-dc7efcd08b822e84e893775084d3b35288462264.zip |
Make TagPolicy Update-aware
This is inspired by https://akkoma.dev/AkkomaGang/akkoma/commit/d5828f1c5e54ca236e50ef7837bfba3d1e665854
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/tag_policy.ex | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex index 10072b693..73760ca8f 100644 --- a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex @@ -27,22 +27,22 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do defp process_tag( "mrf_tag:media-force-nsfw", %{ - "type" => "Create", + "type" => type, "object" => %{"attachment" => child_attachment} } = message ) - when length(child_attachment) > 0 do + when length(child_attachment) > 0 and type in ["Create", "Update"] do {:ok, Kernel.put_in(message, ["object", "sensitive"], true)} end defp process_tag( "mrf_tag:media-strip", %{ - "type" => "Create", + "type" => type, "object" => %{"attachment" => child_attachment} = object } = message ) - when length(child_attachment) > 0 do + when length(child_attachment) > 0 and type in ["Create", "Update"] do object = Map.delete(object, "attachment") message = Map.put(message, "object", object) @@ -152,7 +152,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do do: filter_message(target_actor, message) @impl true - def filter(%{"actor" => actor, "type" => "Create"} = message), + def filter(%{"actor" => actor, "type" => type} = message) when type in ["Create", "Update"], do: filter_message(actor, message) @impl true |