summaryrefslogtreecommitdiff
path: root/packages/sw/src/scripts/create-notification.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-01-08 10:54:45 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-01-08 10:54:45 +0900
commit2e2ed1385fbae6c102156a08fce2defb642e52c5 (patch)
treeb1e9053cf40d82c3542a73952e3c9cc88baad570 /packages/sw/src/scripts/create-notification.ts
parenttweak note componsnt (diff)
downloadsharkey-2e2ed1385fbae6c102156a08fce2defb642e52c5.tar.gz
sharkey-2e2ed1385fbae6c102156a08fce2defb642e52c5.tar.bz2
sharkey-2e2ed1385fbae6c102156a08fce2defb642e52c5.zip
delete pollVote notification
Diffstat (limited to 'packages/sw/src/scripts/create-notification.ts')
-rw-r--r--packages/sw/src/scripts/create-notification.ts68
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();