forked from YokaiRick/akkoma
Implement kaniini's tweaks
This commit is contained in:
parent
c76179419d
commit
a7f07bb6e5
1 changed files with 7 additions and 3 deletions
|
@ -2,13 +2,17 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
|||
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||
|
||||
@impl true
|
||||
def filter(object) do
|
||||
policy = Pleroma.Config.get(:mrf_hellthread)
|
||||
def filter(%{"type" => "Create"} = object) do
|
||||
threshold = Pleroma.Config.get([:mrf_hellthread, :threshold])
|
||||
recipients = (object["to"] || []) ++ (object["cc"] || [])
|
||||
|
||||
if length(object["to"]) + length(object["cc"]) > Keyword.get(policy, :threshold) do
|
||||
if length(recipients) > threshold do
|
||||
{:reject, nil}
|
||||
else
|
||||
{:ok, object}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def filter(object), do: {:ok, object}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue