diff options
| author | Marie <marie@kaifa.ch> | 2024-02-20 15:10:41 +0000 |
|---|---|---|
| committer | Amelia Yukii <amelia.yukii@shourai.de> | 2024-02-20 15:10:41 +0000 |
| commit | 4a13508da0a5d930b4d73bb4208df39a578e7796 (patch) | |
| tree | 4043fefdc93e3c66159d6a6ac565591fa25642ce /packages/sw/src | |
| parent | merge: Warn when missing alt text (!423) (diff) | |
| download | sharkey-4a13508da0a5d930b4d73bb4208df39a578e7796.tar.gz sharkey-4a13508da0a5d930b4d73bb4208df39a578e7796.tar.bz2 sharkey-4a13508da0a5d930b4d73bb4208df39a578e7796.zip | |
Note Edited notification type
Diffstat (limited to 'packages/sw/src')
| -rw-r--r-- | packages/sw/src/scripts/create-notification.ts | 8 | ||||
| -rw-r--r-- | packages/sw/src/sw.ts | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/packages/sw/src/scripts/create-notification.ts b/packages/sw/src/scripts/create-notification.ts index 3e2fb16ec0..32b12f4b4f 100644 --- a/packages/sw/src/scripts/create-notification.ts +++ b/packages/sw/src/scripts/create-notification.ts @@ -232,6 +232,14 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif data, }]; + case 'edited': + return [t('_notification.edited', { name: getUserName(data.body.user) }), { + body: data.body.note.text ?? '', + icon: data.body.user.avatarUrl, + badge: iconUrl('messages'), + data, + }]; + default: return null; } diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index 46fe9fc90f..c38419eadc 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -133,6 +133,9 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv case 'showFollowRequests': client = await swos.openClient('push', '/my/follow-requests', loginId); break; + case 'edited': + if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId); + break; default: switch (data.body.type) { case 'receiveFollowRequest': |