client: remove notification forwarding to service worker

This was an interim measure, but now that push notifications are always enabled,
this should not be necessary any more and the service worker should receive
all notifications automatically.
This commit is contained in:
Johann150 2023-01-29 12:38:38 +01:00
parent 36031c083a
commit 8abd3ebec7
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 0 additions and 11 deletions

View file

@ -33,14 +33,6 @@ const dev: Ref<boolean> = ref(_DEV_);
const onNotification = (notification: { type: string; id: any; }): void => { const onNotification = (notification: { type: string; id: any; }): void => {
if ($i?.mutingNotificationTypes.includes(notification.type)) return; if ($i?.mutingNotificationTypes.includes(notification.type)) return;
// if push notifications are enabled there is no need to pass the notification along
if (!instance.enableServiceWorker) {
// service worker is not enabled or set up on the server, pass the notification along
navigator.serviceWorker.ready.then(registration => {
registration.active.postMessage({ type: 'notification', body: notification });
});
}
sound.play('notification'); sound.play('notification');
}; };

View file

@ -164,9 +164,6 @@ self.addEventListener('message', (ev: ServiceWorkerGlobalScopeEventMap['message'
case 'initialize': case 'initialize':
swLang.setLang(ev.data.lang); swLang.setLang(ev.data.lang);
break; break;
case 'notification':
createNotification(ev.data);
break;
} }
} }
})()); })());