+
+ test "removes report notifs when user isn't superuser any more" do
+ report_activity = insert(:report_activity)
+ user = insert(:user, is_moderator: true, is_admin: true)
+ {:ok, _} = Notification.create_notifications(report_activity)
+
+ assert [%Pleroma.Notification{type: "pleroma:report"}] = Notification.for_user(user)
+
+ {:ok, user} = user |> User.admin_api_update(%{is_moderator: false})
+ # is still superuser because still admin
+ assert [%Pleroma.Notification{type: "pleroma:report"}] = Notification.for_user(user)
+
+ {:ok, user} = user |> User.admin_api_update(%{is_moderator: true, is_admin: false})
+ # is still superuser because still moderator
+ assert [%Pleroma.Notification{type: "pleroma:report"}] = Notification.for_user(user)
+
+ {:ok, user} = user |> User.admin_api_update(%{is_moderator: false})
+ # is not a superuser any more
+ assert [] = Notification.for_user(user)
+ end