From 91c33501a315abe04aeed54aa27388ce0ad241ce Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Mon, 10 Nov 2025 20:51:11 -0500 Subject: Push messaging fixes: * Remove push subscriptions on logout, to trigger a resubscription when logging back in. * Don't try to call `this.push` when there's no `this` to have a `push` on. --- ui/lib/session.svelte.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ui/lib') diff --git a/ui/lib/session.svelte.js b/ui/lib/session.svelte.js index cd41aa4..74508ea 100644 --- a/ui/lib/session.svelte.js +++ b/ui/lib/session.svelte.js @@ -145,7 +145,12 @@ async function bootOrNavigate(navigateTo) { } catch (err) { switch (true) { case err instanceof api.LoggedOut: - await this.push.unsubscribe(); + // Can't use `Push` state manager here as it requires boot, which we just failed to do. + const sw = await navigator.serviceWorker.ready; + const subscription = await sw.pushManager.getSubscription(); + if (subscription !== null) { + await subscription.unsubscribe(); + } await navigateTo('/login'); break; case err instanceof api.SetupRequired: -- cgit v1.2.3