From 82727b825c03f0357e748f5825e4a2e1dee9d145 Mon Sep 17 00:00:00 2001 From: Ezequiel Holzweissig Date: Sat, 10 Apr 2021 20:15:32 -0300 Subject: [PATCH] Fix alerts Fixes #2522 --- CHANGELOG.md | 1 + modules/default/alert/alert.js | 6 +++--- modules/default/alert/notificationFx.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f49e8001..43c52e64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ _This release is scheduled to be released on 2021-04-01._ - Fix calendar start function logging inconsistency. - Fix updatenotification start function logging inconsistency. - Checks and applies the showDescription setting for the newsfeed module again +- Fix alert not recognizing multiple alerts (#2522) ## [2.15.0] - 2021-04-01 diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index 8d175b39..ee52bfc9 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -79,7 +79,7 @@ Module.register("alert", { //If module already has an open alert close it if (this.alerts[sender.name]) { - this.hide_alert(sender); + this.hide_alert(sender,false); } //Display title and message only if they are provided in notification parameters @@ -114,10 +114,10 @@ Module.register("alert", { }, params.timer); } }, - hide_alert: function (sender) { + hide_alert: function (sender,close=true) { //Dismiss alert and remove from this.alerts if (this.alerts[sender.name]) { - this.alerts[sender.name].dismiss(); + this.alerts[sender.name].dismiss(close); this.alerts[sender.name] = null; //Remove overlay const overlay = document.getElementById("overlay"); diff --git a/modules/default/alert/notificationFx.js b/modules/default/alert/notificationFx.js index 89034420..bc9ff997 100644 --- a/modules/default/alert/notificationFx.js +++ b/modules/default/alert/notificationFx.js @@ -123,7 +123,7 @@ /** * Dismiss the notification */ - NotificationFx.prototype.dismiss = function () { + NotificationFx.prototype.dismiss = function (close=true) { this.active = false; clearTimeout(this.dismissttl); this.ntf.classList.remove("ns-show"); @@ -131,7 +131,7 @@ this.ntf.classList.add("ns-hide"); // callback - this.options.onClose(); + if(close) this.options.onClose(); }, 25); // after animation ends remove ntf from the DOM