logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: bcdf336242307a149ab295a760d7b8851063f446
parent 51f1f05b2d17ac1b1471d84481683909c61c373e
Author: Henry Jameson <me@hjkos.com>
Date:   Wed, 13 Dec 2023 18:36:16 +0200

try to fix the "website updated in background" notification

Diffstat:

Msrc/sw.js5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sw.js b/src/sw.js @@ -73,13 +73,16 @@ const showPushNotification = async (event) => { const res = prepareNotificationObject(parsedNotification, i18n) if (state.allowedNotificationTypes.has(parsedNotification.type)) { - self.registration.showNotification(res.title, res) + return self.registration.showNotification(res.title, res) } } + return Promise.resolve() } self.addEventListener('push', async (event) => { if (event.data) { + // Supposedly, we HAVE to return a promise inside waitUntil otherwise it will + // show (extra) notification that website is updated in background event.waitUntil(showPushNotification(event)) } })