logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: dc85b2799063ab5f04a64a0b10a1a91842550d32
parent a893c69d203498b43b4eaeb101447e08901c32c4
Author: nicole mikołajczyk <git@mkljczk.pl>
Date:   Mon, 24 Nov 2025 22:17:05 +0100

Minor cleanup and comment fixes

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>

Diffstat:

Achangelog.d/notification-cleanup.skip0
Mlib/pleroma/notification.ex4+---
Mlib/pleroma/user.ex4++--
Mlib/pleroma/web/common_api/utils.ex35+++++++++++++++++------------------
4 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/changelog.d/notification-cleanup.skip b/changelog.d/notification-cleanup.skip diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex @@ -526,9 +526,7 @@ defmodule Pleroma.Notification do %Activity{data: %{"type" => "Create"}} = activity, local_only ) do - notification_enabled_ap_ids = - [] - |> Utils.maybe_notify_subscribers(activity) + notification_enabled_ap_ids = Utils.get_notified_subscribers(activity) potential_receivers = User.get_users_from_set(notification_enabled_ap_ids, local_only: local_only) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex @@ -233,8 +233,8 @@ defmodule Pleroma.User do for {_relationship_type, [{_outgoing_relation, outgoing_relation_target}, _]} <- @user_relationships_config do # `def blocked_users_relation/2`, `def muted_users_relation/2`, - # `def reblog_muted_users_relation/2`, `def notification_muted_users/2`, - # `def subscriber_users/2`, `def endorsed_users_relation/2` + # `def reblog_muted_users_relation/2`, `def notification_muted_users_relation/2`, + # `def subscriber_users_relation/2`, `def endorsed_users_relation/2` def unquote(:"#{outgoing_relation_target}_relation")(user, restrict_deactivated? \\ false) do target_users_query = assoc(user, unquote(outgoing_relation_target)) diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex @@ -402,8 +402,20 @@ defmodule Pleroma.Web.CommonAPI.Utils do def maybe_notify_mentioned_recipients(recipients, _), do: recipients - def maybe_notify_subscribers( - recipients, + def maybe_notify_followers(recipients, %Activity{data: %{"type" => "Move"}} = activity) do + with %User{} = user <- User.get_cached_by_ap_id(activity.actor) do + user + |> User.get_followers() + |> Enum.map(& &1.ap_id) + |> Enum.concat(recipients) + else + _e -> recipients + end + end + + def maybe_notify_followers(recipients, _), do: recipients + + def get_notified_subscribers( %Activity{data: %{"actor" => actor, "type" => "Create"}} = activity ) do # Do not notify subscribers if author is making a reply @@ -416,26 +428,13 @@ defmodule Pleroma.Web.CommonAPI.Utils do |> Enum.filter(&Visibility.visible_for_user?(activity, &1)) |> Enum.map(& &1.ap_id) - recipients ++ subscriber_ids + subscriber_ids else - _e -> recipients - end - end - - def maybe_notify_subscribers(recipients, _), do: recipients - - def maybe_notify_followers(recipients, %Activity{data: %{"type" => "Move"}} = activity) do - with %User{} = user <- User.get_cached_by_ap_id(activity.actor) do - user - |> User.get_followers() - |> Enum.map(& &1.ap_id) - |> Enum.concat(recipients) - else - _e -> recipients + _e -> [] end end - def maybe_notify_followers(recipients, _), do: recipients + def get_notified_subscribers(_), do: [] def maybe_extract_mentions(%{"tag" => tag}) do tag