mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-21 12:05:07 +01:00
fix(web_push_notifications): Send message with welcome notifications (#4471)
* fix(web_push_notifications): Send grouping title in welcome notification * fix(web_push_notifications): Read message from last notification
This commit is contained in:
parent
e05606c8d0
commit
d4c4820c03
@ -9,7 +9,7 @@ const notify = options =>
|
||||
if (notifications.length === MAX_NOTIFICATIONS) {
|
||||
// Reached the maximum number of notifications, proceed with grouping
|
||||
const group = {
|
||||
title: formatGroupTitle(notifications[0].data.message, notifications.length + 1),
|
||||
title: formatGroupTitle(options.data.message, notifications.length + 1),
|
||||
body: notifications
|
||||
.sort((n1, n2) => n1.timestamp < n2.timestamp)
|
||||
.map(notification => notification.title).join('\n'),
|
||||
@ -19,7 +19,7 @@ const notify = options =>
|
||||
data: {
|
||||
url: (new URL('/web/notifications', self.location)).href,
|
||||
count: notifications.length + 1,
|
||||
message: notifications[0].data.message,
|
||||
message: options.data.message,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -161,6 +161,7 @@ class Web::PushSubscription < ApplicationRecord
|
||||
content: translate('push_notifications.subscribed.body'),
|
||||
actions: [],
|
||||
url: web_url('notifications'),
|
||||
message: translate('push_notifications.group.title'), # Do not pass count, will be formatted in the ServiceWorker
|
||||
}
|
||||
),
|
||||
endpoint: endpoint,
|
||||
|
Loading…
Reference in New Issue
Block a user