From 9af09de7d4a1ec1281b7eb282bcb449397970c25 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 21 Jul 2015 15:35:30 -0700 Subject: [PATCH] Dispatch notifier_enabled when permission given if we don't already have it. --- src/controllers/organisms/Notifier.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/controllers/organisms/Notifier.js b/src/controllers/organisms/Notifier.js index 2c09322aff..29618d8d87 100644 --- a/src/controllers/organisms/Notifier.js +++ b/src/controllers/organisms/Notifier.js @@ -55,16 +55,23 @@ module.exports = { global.Notification.requestPermission(function() { if (callback) { callback(); + dis.dispatch({ + action: "notifier_enabled", + value: true + }); } }); } if (!global.localStorage) return; global.localStorage.setItem('notifications_enabled', 'true'); - dis.dispatch({ - action: "notifier_enabled", - value: true - }); + + if (this.havePermission) { + dis.dispatch({ + action: "notifier_enabled", + value: true + }); + } } else { if (!global.localStorage) return;