Validate admin making report doesn't get their own report notification, but other...
authorMark Felder <feld@feld.me>
Wed, 3 Feb 2021 18:54:53 +0000 (12:54 -0600)
committerMark Felder <feld@feld.me>
Wed, 3 Feb 2021 18:54:53 +0000 (12:54 -0600)
test/pleroma/notification_test.exs

index 0c6ebfb761d512cd352be9794c952f669bdce7ac..948587292af35746b5978bf4b30b30224e481607 100644 (file)
@@ -45,6 +45,20 @@ defmodule Pleroma.NotificationTest do
       assert notification.type == "pleroma:report"
     end
 
+    test "suppresses notification to reporter if reporter is an admin" do
+      reporting_admin = insert(:user, is_admin: true)
+      reported_user = insert(:user)
+      other_admin = insert(:user, is_admin: true)
+
+      {:ok, activity} = CommonAPI.report(reporting_admin, %{account_id: reported_user.id})
+
+      {:ok, [notification]} = Notification.create_notifications(activity)
+
+      refute notification.user_id == reporting_admin.id
+      assert notification.user_id == other_admin.id
+      assert notification.type == "pleroma:report"
+    end
+
     test "creates a notification for an emoji reaction" do
       user = insert(:user)
       other_user = insert(:user)