Exclude reporter from receiving notifications from their own reports.
authorMark Felder <feld@feld.me>
Wed, 3 Feb 2021 18:32:44 +0000 (12:32 -0600)
committerMark Felder <feld@feld.me>
Wed, 3 Feb 2021 18:32:44 +0000 (12:32 -0600)
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.

lib/pleroma/notification.ex
lib/pleroma/web/activity_pub/activity_pub.ex

index 55b51321287426fd00abb22e0e8185b59066b6ee..1970fbf65d1611ac907fdeaa78aa6f660404e5d2 100644 (file)
@@ -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
index 1a84375fb38166c5d1b9f5e2002736e330c3d2c1..5b45e2ca1dca30c5488b53c4477d73958c25aeb3 100644 (file)
@@ -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