diff options
Diffstat (limited to 'packages/sw/src/scripts/create-notification.ts')
| -rw-r--r-- | packages/sw/src/scripts/create-notification.ts | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/packages/sw/src/scripts/create-notification.ts b/packages/sw/src/scripts/create-notification.ts index a324851fe2..4b006e0f5a 100644 --- a/packages/sw/src/scripts/create-notification.ts +++ b/packages/sw/src/scripts/create-notification.ts @@ -51,8 +51,8 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: userDetail.isFollowing ? [] : [ { action: 'follow', - title: t('_notification._actions.followBack') - } + title: t('_notification._actions.followBack'), + }, ], }]; } @@ -66,8 +66,8 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') - } + title: t('_notification._actions.reply'), + }, ], }]; @@ -80,8 +80,8 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') - } + title: t('_notification._actions.reply'), + }, ], }]; @@ -94,8 +94,8 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'showUser', - title: getUserName(data.body.user) - } + title: getUserName(data.body.user), + }, ], }]; @@ -108,14 +108,14 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'reply', - title: t('_notification._actions.reply') + title: t('_notification._actions.reply'), }, ...((data.body.note.visibility === 'public' || data.body.note.visibility === 'home') ? [ - { - action: 'renote', - title: t('_notification._actions.renote') - } - ] : []) + { + action: 'renote', + title: t('_notification._actions.renote'), + }, + ] : []), ], }]; @@ -141,7 +141,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data const dummy = `${encodeURIComponent(`${u.host}${u.pathname}`)}.png`; badge = `${origin}/proxy/${dummy}?${url.query({ url: u.href, - badge: '1' + badge: '1', })}`; } } @@ -162,20 +162,12 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'showUser', - title: getUserName(data.body.user) - } + title: getUserName(data.body.user), + }, ], }]; } - case 'pollVote': - return [t('_notification.youGotPoll', { name: getUserName(data.body.user) }), { - body: data.body.note.text || '', - icon: data.body.user.avatarUrl, - badge: iconUrl('poll-h'), - data, - }]; - case 'pollEnded': return [t('_notification.pollEnded'), { body: data.body.note.text || '', @@ -192,12 +184,12 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'accept', - title: t('accept') + title: t('accept'), }, { action: 'reject', - title: t('reject') - } + title: t('reject'), + }, ], }]; @@ -217,21 +209,21 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data actions: [ { action: 'accept', - title: t('accept') + title: t('accept'), }, { action: 'reject', - title: t('reject') - } + title: t('reject'), + }, ], }]; case 'app': - return [data.body.header || data.body.body, { - body: data.body.header && data.body.body, - icon: data.body.icon, - data - }]; + return [data.body.header || data.body.body, { + body: data.body.header && data.body.body, + icon: data.body.icon, + data, + }]; default: return null; @@ -279,7 +271,7 @@ export async function createEmptyNotification() { silent: true, badge: iconUrl('null'), tag: 'read_notification', - } + }, ); res(); @@ -288,7 +280,7 @@ export async function createEmptyNotification() { for (const n of [ ...(await self.registration.getNotifications({ tag: 'user_visible_auto_notification' })), - ...(await self.registration.getNotifications({ tag: 'read_notification' })) + ...(await self.registration.getNotifications({ tag: 'read_notification' })), ] ) { n.close(); |