AntiDuplicationPolicy: fix messing up Announces

This commit is contained in:
Alex Gleason 2023-05-21 16:12:33 -05:00
parent 663574bea9
commit 7adead8df8
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -5,11 +5,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiDuplicationPolicy do
@cachex Pleroma.Config.get([:cachex, :provider], Cachex) @cachex Pleroma.Config.get([:cachex, :provider], Cachex)
@cache :anti_duplication_mrf_cache @cache :anti_duplication_mrf_cache
@object_types ~w[Note Article Page ChatMessage Question Event]
@impl true @impl true
def filter(%{"type" => type, "content" => content} = object) def filter(%{"type" => "Create", "object" => %{"content" => content} = object})
when is_binary(content) and type in @object_types do when is_binary(content) do
ttl = Pleroma.Config.get([:mrf_anti_duplication, :ttl], :timer.minutes(1)) ttl = Pleroma.Config.get([:mrf_anti_duplication, :ttl], :timer.minutes(1))
min_length = Pleroma.Config.get([:mrf_anti_duplication, :min_length], 50) min_length = Pleroma.Config.get([:mrf_anti_duplication, :min_length], 50)
@ -31,11 +29,6 @@ def filter(%{"type" => type, "content" => content} = object)
end end
end end
def filter(%{"object" => %{"type" => type, "content" => content} = object})
when is_binary(content) and type in @object_types do
filter(object)
end
def filter(object) do def filter(object) do
{:ok, object} {:ok, object}
end end