diff --git a/static/subscriptions.js b/static/subscriptions.js index dd3bdd2..2b2c2b7 100644 --- a/static/subscriptions.js +++ b/static/subscriptions.js @@ -145,8 +145,16 @@ async function renderPushBar() { btn.disabled = true; const original = btn.textContent; try { - await pushClient.sendTest(); - btn.textContent = "Sent ✓"; + const r = await pushClient.sendTest(); + if (!r.devices) { + btn.textContent = "No device"; + alert("No device is registered for push on this account. Turn alerts off and on again on this device to re-subscribe."); + } else if (r.sent > 0) { + btn.textContent = "Sent ✓"; + } else { + btn.textContent = "Failed"; + alert("The push service rejected delivery to this device. Turn alerts off and on again to re-subscribe; if it keeps failing, the server's push (VAPID) keys may have changed."); + } } catch (err) { alert(err.message || "Couldn't send a test notification."); }