Merge branch 'fix/reports-from-admins' into 'develop'
Suppress report notification for admin actors See merge request pleroma/pleroma!3301
This commit is contained in:
commit
8babd796da
@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script
|
- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script
|
||||||
- Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address.
|
- Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address.
|
||||||
- Provide redirect of external posts from `/notice/:id` to their original URL
|
- Provide redirect of external posts from `/notice/:id` to their original URL
|
||||||
|
- Admins no longer receive notifications for reports if they are the actor making the report.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
|
@ -507,8 +507,8 @@ defmodule Pleroma.Notification do
|
|||||||
[object_id]
|
[object_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag"}}) do
|
def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag", "actor" => actor}}) do
|
||||||
User.all_superusers() |> Enum.map(fn user -> user.ap_id end)
|
(User.all_superusers() |> Enum.map(fn user -> user.ap_id end)) -- [actor]
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_potential_receiver_ap_ids(activity) do
|
def get_potential_receiver_ap_ids(activity) do
|
||||||
|
@ -377,6 +377,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||||||
:ok <-
|
:ok <-
|
||||||
maybe_federate(stripped_activity) do
|
maybe_federate(stripped_activity) do
|
||||||
User.all_superusers()
|
User.all_superusers()
|
||||||
|
|> Enum.filter(fn user -> user.ap_id != actor end)
|
||||||
|> Enum.filter(fn user -> not is_nil(user.email) end)
|
|> Enum.filter(fn user -> not is_nil(user.email) end)
|
||||||
|> Enum.each(fn superuser ->
|
|> Enum.each(fn superuser ->
|
||||||
superuser
|
superuser
|
||||||
|
@ -45,6 +45,20 @@ defmodule Pleroma.NotificationTest do
|
|||||||
assert notification.type == "pleroma:report"
|
assert notification.type == "pleroma:report"
|
||||||
end
|
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
|
test "creates a notification for an emoji reaction" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
|
Loading…
Reference in New Issue
Block a user