mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 11:19:19 +00:00
22 lines
612 B
Elixir
22 lines
612 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
|
|
|
@impl true
|
|
def filter(%{"type" => "Create"} = object) do
|
|
threshold = Pleroma.Config.get([:mrf_hellthread, :threshold])
|
|
recipients = (object["to"] || []) ++ (object["cc"] || [])
|
|
|
|
if length(recipients) > threshold do
|
|
{:reject, nil}
|
|
else
|
|
{:ok, object}
|
|
end
|
|
end
|
|
|
|
@impl true
|
|
def filter(object), do: {:ok, object}
|
|
end
|