summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-01-30 10:41:52 -0500
committerMark Felder <feld@feld.me>2024-01-30 10:41:52 -0500
commit2f9ff1a35ddd7f938bc982504eec5eb8c4174392 (patch)
tree9fa25e77581b8085be831988ebd5b994bd23c991
parent0815927e319a2d6a656782c39e6b73a858c1e506 (diff)
Skip generating notifications for internal usersfix-muted-web-push
-rw-r--r--lib/pleroma/notification.ex7
-rw-r--r--lib/pleroma/web/activity_pub/side_effects.ex11
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index 7e9c12d5e..fa1b368b9 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -630,6 +630,7 @@ defmodule Pleroma.Notification do
def skip?(%Activity{} = activity, %User{} = user, opts) do
[
:self,
+ :internal,
:invisible,
:block_from_strangers,
:recently_followed,
@@ -649,6 +650,12 @@ defmodule Pleroma.Notification do
end
end
+ def skip?(:internal, %Activity{} = activity, _user, _opts) do
+ actor = activity.data["actor"]
+ user = User.get_cached_by_ap_id(actor)
+ User.internal?(user)
+ end
+
def skip?(:invisible, %Activity{} = activity, _user, _opts) do
actor = activity.data["actor"]
user = User.get_cached_by_ap_id(actor)
diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex
index 982927e16..7ae16eb57 100644
--- a/lib/pleroma/web/activity_pub/side_effects.ex
+++ b/lib/pleroma/web/activity_pub/side_effects.ex
@@ -261,16 +261,9 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
Utils.add_announce_to_object(object, announced_object)
- notifications =
- if !User.is_internal_user?(user) do
- {:ok, notifications} = Notification.create_notifications(object)
-
- ap_streamer().stream_out(object)
+ {:ok, notifications} = Notification.create_notifications(object)
- notifications
- else
- []
- end
+ if !User.internal?(user), do: ap_streamer().stream_out(object)
meta =
meta