From 9af562fda2d8d0c5cd57efe73daa8cbc1a1f84d3 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 11 Jan 2023 14:31:49 +0200 Subject: [PATCH] notifications fix --- client/src/views/notification/badge.js | 30 +++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/client/src/views/notification/badge.js b/client/src/views/notification/badge.js index 75ccaa6e36..ac956074cd 100644 --- a/client/src/views/notification/badge.js +++ b/client/src/views/notification/badge.js @@ -35,9 +35,22 @@ define('views/notification/badge', ['view'], function (Dep) { notificationsCheckInterval: 10, groupedCheckInterval: 15, + /** @private */ + useWebSocket: false, + timeout: null, groupedTimeout: null, + /** + * @type {{ + * portalDisabled?: boolean, + * grouped?: boolean, + * disabled?: boolean, + * interval?: Number, + * url?: string, + * useWebSocket?: boolean, + * }|null} + */ popupNotificationsData: null, soundPath: 'client/sounds/pop_cork', @@ -289,6 +302,10 @@ define('views/notification/badge', ['view'], function (Dep) { }); } + if (this.useWebSocket) { + return; + } + this.groupedTimeout = setTimeout( () => this.checkGroupedPopupNotifications(), this.groupedCheckInterval * 1000 @@ -302,8 +319,6 @@ define('views/notification/badge', ['view'], function (Dep) { let interval = data.interval; let disabled = data.disabled || false; - let isFirstCheck = !isNotFirstCheck; - if (disabled) { return; } @@ -328,16 +343,7 @@ define('views/notification/badge', ['view'], function (Dep) { }); } - if (data.grouped && interval && !useWebSocket && isFirstCheck) { - this.popupTimeouts[name] = setTimeout( - () => this.checkPopupNotifications(name, true), - interval * 1000 - ); - - return; - } - - if (data.grouped && isFirstCheck) { + if (data.grouped) { return; }