mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 19:38:24 +00:00
Merge pull request #3919 from tgxworld/fix_double_notifications
FIX: Incorrect key when checking for primary tab.
This commit is contained in:
commit
3c3d7c03f0
@ -11,7 +11,8 @@ let lastAction = -1;
|
|||||||
const focusTrackerKey = "focus-tracker";
|
const focusTrackerKey = "focus-tracker";
|
||||||
const idleThresholdTime = 1000 * 10; // 10 seconds
|
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
|
// Called from an initializer
|
||||||
function init(messageBus) {
|
function init(messageBus) {
|
||||||
@ -60,7 +61,7 @@ function setupNotifications() {
|
|||||||
window.addEventListener("storage", function(e) {
|
window.addEventListener("storage", function(e) {
|
||||||
// note: This event only fires when other tabs setItem()
|
// note: This event only fires when other tabs setItem()
|
||||||
const key = e.key;
|
const key = e.key;
|
||||||
if (key !== focusTrackerKey) {
|
if (key !== `${context}${focusTrackerKey}`) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
primaryTab = false;
|
primaryTab = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user