diff options
author | Karen Konou <konoukaren@gmail.com> | 2018-12-23 12:24:53 +0100 |
---|---|---|
committer | Karen Konou <konoukaren@gmail.com> | 2018-12-23 12:24:53 +0100 |
commit | a7f07bb6e56ad5173b9c2063d7f920cd102b4f2d (patch) | |
tree | b7f7f9b8b09dd04537e3879833e72a61113cf00b /lib | |
parent | c76179419d5d4bb2423496856ad931974b56d6d5 (diff) | |
download | pleroma-a7f07bb6e56ad5173b9c2063d7f920cd102b4f2d.tar.gz |
Implement kaniini's tweaks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex index d5aa2b988..55d6ff3f0 100644 --- a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex @@ -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 |