mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 05:23:09 +02:00
fix(sw): 通知全削除時にread_notification通知が消えないように
通知欄に現れたり消えたりするとうざい
This commit is contained in:
parent
aa289c9cb0
commit
471b836a44
1 changed files with 2 additions and 2 deletions
|
@ -56,7 +56,7 @@ globalThis.addEventListener('push', ev => {
|
||||||
return createNotification(data);
|
return createNotification(data);
|
||||||
case 'readAllNotifications':
|
case 'readAllNotifications':
|
||||||
await globalThis.registration.getNotifications()
|
await globalThis.registration.getNotifications()
|
||||||
.then(notifications => notifications.forEach(n => n.close()));
|
.then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'markAllAsRead':
|
case 'markAllAsRead':
|
||||||
await globalThis.registration.getNotifications()
|
await globalThis.registration.getNotifications()
|
||||||
.then(notifications => notifications.forEach(n => n.close()));
|
.then(notifications => notifications.forEach(n => n.tag !== 'read_notification' && n.close()));
|
||||||
await get('accounts').then(accounts => {
|
await get('accounts').then(accounts => {
|
||||||
return Promise.all(accounts.map(async account => {
|
return Promise.all(accounts.map(async account => {
|
||||||
await swos.sendMarkAllAsRead(account.id);
|
await swos.sendMarkAllAsRead(account.id);
|
||||||
|
|
Loading…
Reference in a new issue