From 7bf4ebf2f6c914895e80a36588e9140c7f0f4402 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Sat, 12 Dec 2015 11:43:43 +0800 Subject: [PATCH] FIX: Incorrect key when checking for primary tab. --- .../javascripts/discourse/lib/desktop-notifications.js.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 index b5563162322..d20a1c0109d 100644 --- a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 +++ b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 @@ -11,7 +11,8 @@ let lastAction = -1; const focusTrackerKey = "focus-tracker"; const idleThresholdTime = 1000 * 10; // 10 seconds -const keyValueStore = new KeyValueStore("discourse_desktop_notifications_"); +const context = "discourse_desktop_notifications_"; +const keyValueStore = new KeyValueStore(context); // Called from an initializer function init(messageBus) { @@ -60,7 +61,7 @@ function setupNotifications() { window.addEventListener("storage", function(e) { // note: This event only fires when other tabs setItem() const key = e.key; - if (key !== focusTrackerKey) { + if (key !== `${context}${focusTrackerKey}`) { return true; } primaryTab = false;