Merge branch 'add-activity-id-to-push-messages' into 'develop'
WebPush: Add activity id to the push messages. See merge request pleroma/pleroma!925
This commit is contained in:
commit
f9a9639015
|
@ -20,7 +20,10 @@ defmodule Pleroma.Web.Push.Impl do
|
||||||
|
|
||||||
@doc "Performs sending notifications for user subscriptions"
|
@doc "Performs sending notifications for user subscriptions"
|
||||||
@spec perform_send(Notification.t()) :: list(any)
|
@spec perform_send(Notification.t()) :: list(any)
|
||||||
def perform_send(%{activity: %{data: %{"type" => activity_type}}, user_id: user_id} = notif)
|
def perform_send(
|
||||||
|
%{activity: %{data: %{"type" => activity_type}, id: activity_id}, user_id: user_id} =
|
||||||
|
notif
|
||||||
|
)
|
||||||
when activity_type in @types do
|
when activity_type in @types do
|
||||||
actor = User.get_cached_by_ap_id(notif.activity.data["actor"])
|
actor = User.get_cached_by_ap_id(notif.activity.data["actor"])
|
||||||
|
|
||||||
|
@ -37,7 +40,10 @@ def perform_send(%{activity: %{data: %{"type" => activity_type}}, user_id: user_
|
||||||
notification_id: notif.id,
|
notification_id: notif.id,
|
||||||
notification_type: type,
|
notification_type: type,
|
||||||
icon: avatar_url,
|
icon: avatar_url,
|
||||||
preferred_locale: "en"
|
preferred_locale: "en",
|
||||||
|
pleroma: %{
|
||||||
|
activity_id: activity_id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|> Jason.encode!()
|
|> Jason.encode!()
|
||||||
|> push_message(build_sub(subscription), gcm_api_key, subscription)
|
|> push_message(build_sub(subscription), gcm_api_key, subscription)
|
||||||
|
|
Loading…
Reference in New Issue