diff options
author | Karen Konou <konoukaren@gmail.com> | 2019-02-15 13:43:14 +0100 |
---|---|---|
committer | Karen Konou <konoukaren@gmail.com> | 2019-02-15 13:43:14 +0100 |
commit | dca6bee2f7eba1dc366cc65d3087f20678549739 (patch) | |
tree | 9ee72e6f9649a2c9a16b3734a084ed44283751c0 /lib | |
parent | d943c90249e0a598e57a0dbdf41d387b53916092 (diff) | |
download | pleroma-dca6bee2f7eba1dc366cc65d3087f20678549739.tar.gz |
Rename test, add check for follower collection when delisting
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex index 95211c596..1fd7b9c67 100644 --- a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex @@ -10,17 +10,22 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do delist_threshold = Pleroma.Config.get([:mrf_hellthread, :delist_threshold]) follower_collection = User.get_cached_by_ap_id(message["actor"]).follower_address + follower_collection? = Enum.member?(message["to"] ++ message["cc"], follower_collection) + message = - with {:public, recipients} <- get_recipient_count(message) do - if recipients > delist_threshold and delist_threshold > 0 do + case recipients = get_recipient_count(message) do + {:public, _} when follower_collection? and recipients > delist_threshold -> message |> Map.put("to", [follower_collection]) |> Map.put("cc", ["https://www.w3.org/ns/activitystreams#Public"]) - else + + {:public, _} when recipients > delist_threshold -> + message + |> Map.put("to", []) + |> Map.put("cc", ["https://www.w3.org/ns/activitystreams#Public"]) + + _ -> message - end - else - _ -> message end {:ok, message} |