Skip to content

Commit edc4352

Browse files
committed
fix(webpush): notification must reflect the actual outcome
Signed-off-by: 0xsysr3ll <[email protected]>
1 parent e21bb46 commit edc4352

File tree

1 file changed

+11
-1
lines changed
  • src/components/UserProfile/UserSettings/UserNotificationSettings/UserNotificationsWebPush

1 file changed

+11
-1
lines changed

src/components/UserProfile/UserSettings/UserNotificationSettings/UserNotificationsWebPush/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,23 @@ const UserWebPushSettings = () => {
120120
if (endpointToDelete) {
121121
await deletePushSubscriptionFromBackend(endpointToDelete);
122122
} else if (dataDevices && dataDevices.length > 0) {
123+
let hasFailures = false;
124+
123125
for (const device of dataDevices) {
124126
try {
125127
await deletePushSubscriptionFromBackend(device.endpoint);
126128
} catch (error) {
127-
// Continue deleting other subscriptions even if one fails
129+
hasFailures = true;
128130
}
129131
}
132+
133+
if (hasFailures) {
134+
addToast(intl.formatMessage(messages.disablingwebpusherror), {
135+
autoDismiss: true,
136+
appearance: 'error',
137+
});
138+
return;
139+
}
130140
}
131141

132142
localStorage.setItem('pushNotificationsEnabled', 'false');

0 commit comments

Comments
 (0)