edcbc5219eb63865be57690ad428a758d08d8d7a
[akkoma] / lib / pleroma / web / activity_pub / mrf / hellthread_policy.ex
1 defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
2 @behaviour Pleroma.Web.ActivityPub.MRF
3
4 @impl true
5 def filter(object) do
6 policy = Pleroma.Config.get(:mrf_hellthreadmitigation)
7
8 if length(object["to"]) + length(object["cc"]) > Keyword.get(policy, :threshold) do
9 {:reject, nil}
10 else
11 {:ok, object}
12 end
13 end
14 end