diff --git a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 index 4831fe00942..35a522637db 100644 --- a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 +++ b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 @@ -16,20 +16,21 @@ function init(container) { try { localStorage.getItem(focusTrackerKey); } catch (e) { - liveEnabled = false; Em.Logger.info('Discourse desktop notifications are disabled - localStorage denied.'); - return; + return false; } liveEnabled = true; Em.Logger.info('Discourse desktop notifications are enabled.'); - }).then(function() { - try { - init2(container); - } catch (e) { - console.error(e); + return true; + }).then(function(c) { + if (c) { + try { + init2(container); + } catch (e) { + console.error(e); + } } }).catch(function(e) { - debugger; liveEnabled = false; Em.Logger.info('Discourse desktop notifications are disabled - permission denied.'); }); @@ -145,6 +146,10 @@ function onNotification(currentUser) { tag: notificationTagName }); + // if (enableSound) { + // soundElement.play(); + // } + const firstUnseen = unseen[0]; function clickEventHandler() {