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
|
2018-12-23 10:14:29 +00:00
|
|
|
policy = Pleroma.Config.get(:mrf_hellthread)
|
2018-12-22 22:18:31 +00:00
|
|
|
|
2018-12-22 22:32:38 +00:00
|
|
|
if length(object["to"]) + length(object["cc"]) > Keyword.get(policy, :threshold) do
|
2018-12-22 22:18:31 +00:00
|
|
|
{:reject, nil}
|
|
|
|
else
|
|
|
|
{:ok, object}
|
|
|
|
end
|
|
|
|
end
|
2018-12-22 22:32:38 +00:00
|
|
|
end
|