From 9fd3940b7d363f115fe19433a2b7b8f3f97d49d8 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Wed, 4 Jan 2023 12:31:47 +0100 Subject: [PATCH] Don't check push subscription when not logged in --- app/javascript/retrospring/features/webpush/unsubscribe.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/javascript/retrospring/features/webpush/unsubscribe.ts b/app/javascript/retrospring/features/webpush/unsubscribe.ts index e5082a1b..bf667137 100644 --- a/app/javascript/retrospring/features/webpush/unsubscribe.ts +++ b/app/javascript/retrospring/features/webpush/unsubscribe.ts @@ -14,6 +14,9 @@ export function unsubscribeHandler(): void { } export function checkSubscription(subscription: PushSubscription): void { + // We can have a subscription active for any user while not logged in. + if (document.body.classList.contains('not-logged-in')) return; + post('/ajax/webpush/check', { body: { endpoint: subscription.endpoint