logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: c25fda34e7560d0d8eb5fdbfb444b641c4c4bf53
parent 291d531e4cbdb5b63edb5b43914d82dafe356907
Author: Mark Felder <feld@feld.me>
Date:   Tue, 30 Jan 2024 10:41:52 -0500

Skip generating notifications for internal users

Diffstat:

Mlib/pleroma/notification.ex7+++++++
Mlib/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 @@ -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 @@ -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