From 9d872c3fd75d253d448896f64bf8d5fc958fbe75 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 2 Nov 2020 11:13:06 +0200 Subject: [PATCH 1/4] cs fix --- client/src/views/notification/badge.js | 81 ++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/client/src/views/notification/badge.js b/client/src/views/notification/badge.js index cb9407785c..30887b7fc6 100644 --- a/client/src/views/notification/badge.js +++ b/client/src/views/notification/badge.js @@ -57,6 +57,7 @@ define('views/notification/badge', 'view', function (Dep) { if (this.timeout) { clearTimeout(this.timeout); } + for (var name in this.popoupTimeouts) { clearTimeout(this.popoupTimeouts[name]); } @@ -76,8 +77,10 @@ define('views/notification/badge', 'view', function (Dep) { window.addEventListener('storage', function (e) { if (e.key == 'messageClosePopupNotificationId') { var id = localStorage.getItem('messageClosePopupNotificationId'); + if (id) { var key = 'popup-' + id; + if (this.hasView(key)) { this.markPopupRemoved(id); this.clearView(key); @@ -102,18 +105,22 @@ define('views/notification/badge', 'view', function (Dep) { this.runCheckUpdates(true); this.$popupContainer = $('#popup-notifications-container'); + if (!$(this.$popupContainer).length) { this.$popupContainer = $('
').attr('id', 'popup-notifications-container').addClass('hidden').appendTo('body'); } var popupNotificationsData = this.popupNotificationsData = this.getMetadata().get('app.popupNotifications') || {}; + for (var name in popupNotificationsData) { this.checkPopupNotifications(name); } }, playSound: function () { - if (this.notificationSoundsDisabled) return; + if (this.notificationSoundsDisabled) { + return; + } var html = '' + '