commit: 603a57576638c9732fe873db3c2b8d56d0a413a5
parent 568819c08afee68636a4871e78838db1ac1f590c
Author: Mark Felder <feld@feld.me>
Date: Tue, 11 Jun 2024 18:14:07 -0400
The user is not always preloaded into the notification
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex
@@ -27,7 +27,7 @@ defmodule Pleroma.Web.Push.Impl do
def build(
%{
activity: %{data: %{"type" => activity_type}} = activity,
- user: user
+ user_id: user_id
} = notification
)
when activity_type in @types do
@@ -35,9 +35,10 @@ defmodule Pleroma.Web.Push.Impl do
avatar_url = User.avatar_url(notification_actor)
object = Object.normalize(activity, fetch: false)
+ user = User.get_cached_by_id(user_id)
direct_conversation_id = Activity.direct_conversation_id(activity, user)
- subscriptions = fetch_subscriptions(user.id)
+ subscriptions = fetch_subscriptions(user_id)
subscriptions
|> Enum.filter(&Subscription.enabled?(&1, notification.type))