Merge pull request #1896 from thelounge/xpaw/fix-push-error

Fix error not showing up in failed push subscription
This commit is contained in:
Pavel Djundik 2017-12-24 22:53:04 +02:00 committed by GitHub
commit d2106f1782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,7 +68,7 @@ module.exports.initialize = () => {
function onPushButton() { function onPushButton() {
pushNotificationsButton.attr("disabled", true); pushNotificationsButton.attr("disabled", true);
navigator.serviceWorker.ready.then((registration) => { navigator.serviceWorker.ready.then((registration) =>
registration.pushManager.getSubscription().then((existingSubscription) => { registration.pushManager.getSubscription().then((existingSubscription) => {
if (existingSubscription) { if (existingSubscription) {
socket.emit("push:unregister"); socket.emit("push:unregister");
@ -100,9 +100,11 @@ function onPushButton() {
if (successful) { if (successful) {
alternatePushButton().removeAttr("disabled"); alternatePushButton().removeAttr("disabled");
} }
}); })
}).catch((err) => { ).catch((err) => {
$("#pushNotificationsUnsupported span").text(err).show(); $("#pushNotificationsUnsupported")
.find("span").text(`An error has occured: ${err}`).end()
.show();
}); });
return false; return false;