Implement kaniini's tweaks
[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(%{"type" => "Create"} = object) do
6 threshold = Pleroma.Config.get([:mrf_hellthread, :threshold])
7 recipients = (object["to"] || []) ++ (object["cc"] || [])
8
9 if length(recipients) > threshold do
10 {:reject, nil}
11 else
12 {:ok, object}
13 end
14 end
15
16 @impl true
17 def filter(object), do: {:ok, object}
18 end