Skip generating notifications for internal users

This commit is contained in:
Mark Felder 2024-01-30 10:41:52 -05:00
parent 291d531e4c
commit c25fda34e7
2 changed files with 9 additions and 9 deletions

View File

@ -630,6 +630,7 @@ def skip?(activity, user, opts \\ [])
def skip?(%Activity{} = activity, %User{} = user, opts) do def skip?(%Activity{} = activity, %User{} = user, opts) do
[ [
:self, :self,
:internal,
:invisible, :invisible,
:block_from_strangers, :block_from_strangers,
:recently_followed, :recently_followed,
@ -649,6 +650,12 @@ def skip?(:self, %Activity{} = activity, %User{} = user, opts) do
end end
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 def skip?(:invisible, %Activity{} = activity, _user, _opts) do
actor = activity.data["actor"] actor = activity.data["actor"]
user = User.get_cached_by_ap_id(actor) user = User.get_cached_by_ap_id(actor)

View File

@ -261,16 +261,9 @@ def handle(%{data: %{"type" => "Announce"}} = object, meta) do
Utils.add_announce_to_object(object, announced_object) Utils.add_announce_to_object(object, announced_object)
notifications = {:ok, notifications} = Notification.create_notifications(object)
if !User.is_internal_user?(user) do
{:ok, notifications} = Notification.create_notifications(object)
ap_streamer().stream_out(object) if !User.internal?(user), do: ap_streamer().stream_out(object)
notifications
else
[]
end
meta = meta =
meta meta