akkoma/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex

15 lines
355 B
Elixir
Raw Normal View History

2018-12-22 22:18:31 +00:00
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
@behaviour Pleroma.Web.ActivityPub.MRF
@impl true
def filter(object) do
policy = Pleroma.Config.get(:mrf_hellthreadmitigation)
if (length(object["to"]) + length(object["cc"])) > Keyword.get(policy, :threshold) do
{:reject, nil}
else
{:ok, object}
end
end
end