diff options
author | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-04-14 19:22:47 -0500 |
commit | 4fe1689de43f4404eb9530fcfbcbfb26d6c1c13a (patch) | |
tree | 6811b845bb7f4966b10dcefa3dea404246f161c7 /app/javascript/mastodon/service_worker/web_push_notifications.js | |
parent | 65c1e53a32cabcdbb7bca57002bb0f6acdebe07e (diff) | |
parent | bed63f6dae0879ac840066b031229e0d139089cd (diff) |
Diffstat (limited to 'app/javascript/mastodon/service_worker/web_push_notifications.js')
-rw-r--r-- | app/javascript/mastodon/service_worker/web_push_notifications.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/javascript/mastodon/service_worker/web_push_notifications.js b/app/javascript/mastodon/service_worker/web_push_notifications.js index f12595777..b9d626694 100644 --- a/app/javascript/mastodon/service_worker/web_push_notifications.js +++ b/app/javascript/mastodon/service_worker/web_push_notifications.js @@ -1,6 +1,6 @@ import IntlMessageFormat from 'intl-messageformat'; -import locales from './web_push_locales'; import { unescape } from 'lodash'; +import locales from './web_push_locales'; const MAX_NOTIFICATIONS = 5; const GROUP_TAG = 'tag'; @@ -90,7 +90,13 @@ export const handlePush = (event) => { options.tag = notification.id; options.badge = '/badge.png'; options.image = notification.status && notification.status.media_attachments.length > 0 && notification.status.media_attachments[0].preview_url || undefined; - options.data = { access_token, preferred_locale, id: notification.status ? notification.status.id : notification.account.id, url: notification.status ? `/@${notification.account.acct}/${notification.status.id}` : `/@${notification.account.acct}` }; + options.data = { access_token, preferred_locale, id: notification.status ? notification.status.id : notification.account.id }; + + if (notification.status) { + options.data.url = `/@${notification.status.account.acct}/${notification.status.id}`; + } else { + options.data.url = `/@${notification.account.acct}`; + } if (notification.status && notification.status.spoiler_text || notification.status.sensitive) { options.data.hiddenBody = htmlToPlainText(notification.status.content); |