logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 76f732766ba36c3a94cf6b8b39fb745c1cf3f49a
parent a7864a94295eedaee1c2ad0829c9b668c7acd705
Author: Mark Felder <feld@feld.me>
Date:   Wed,  3 Feb 2021 12:32:44 -0600

Exclude reporter from receiving notifications from their own reports.
Currently only works if the reporting actor is an admin, but if we include
moderators with those who receive notification reports it will work for them.

Diffstat:

Mlib/pleroma/notification.ex4++--
Mlib/pleroma/web/activity_pub/activity_pub.ex1+
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex @@ -507,8 +507,8 @@ defmodule Pleroma.Notification do [object_id] end - def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag"}}) do - User.all_superusers() |> Enum.map(fn user -> user.ap_id end) + def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag", "actor" => actor}}) do + (User.all_superusers() |> Enum.map(fn user -> user.ap_id end)) -- [actor] end def get_potential_receiver_ap_ids(activity) do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -377,6 +377,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do :ok <- maybe_federate(stripped_activity) do User.all_superusers() + |> Enum.filter(fn user -> user.ap_id != actor end) |> Enum.filter(fn user -> not is_nil(user.email) end) |> Enum.each(fn superuser -> superuser