Merge pull request #3919 from tgxworld/fix_double_notifications

FIX: Incorrect key when checking for primary tab.
This commit is contained in:
Régis Hanol 2015-12-12 10:54:27 +01:00
commit 3c3d7c03f0

View File

@ -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;