Merge pull request #2532 from ezeholz/develop

Alert Module not recognizing multiple alerts
This commit is contained in:
Michael Teeuw 2021-04-14 16:17:45 +02:00 committed by GitHub
commit ac27d05fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -30,6 +30,7 @@ _This release is scheduled to be released on 2021-04-01._
- Fix tests in weather module and add one for decimalPoint in forecast - Fix tests in weather module and add one for decimalPoint in forecast
- Fix decimalSymbol in the forcast part of the new weather module #2530 - Fix decimalSymbol in the forcast part of the new weather module #2530
- Fix wrong treatment of `appendLocationNameToHeader` when using `ukmetofficedatahub` - Fix wrong treatment of `appendLocationNameToHeader` when using `ukmetofficedatahub`
- Fix alert not recognizing multiple alerts (#2522)
## [2.15.0] - 2021-04-01 ## [2.15.0] - 2021-04-01

View File

@ -79,7 +79,7 @@ Module.register("alert", {
//If module already has an open alert close it //If module already has an open alert close it
if (this.alerts[sender.name]) { 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 //Display title and message only if they are provided in notification parameters
@ -114,10 +114,10 @@ Module.register("alert", {
}, params.timer); }, params.timer);
} }
}, },
hide_alert: function (sender) { hide_alert: function (sender, close = true) {
//Dismiss alert and remove from this.alerts //Dismiss alert and remove from this.alerts
if (this.alerts[sender.name]) { if (this.alerts[sender.name]) {
this.alerts[sender.name].dismiss(); this.alerts[sender.name].dismiss(close);
this.alerts[sender.name] = null; this.alerts[sender.name] = null;
//Remove overlay //Remove overlay
const overlay = document.getElementById("overlay"); const overlay = document.getElementById("overlay");

View File

@ -123,7 +123,7 @@
/** /**
* Dismiss the notification * Dismiss the notification
*/ */
NotificationFx.prototype.dismiss = function () { NotificationFx.prototype.dismiss = function (close = true) {
this.active = false; this.active = false;
clearTimeout(this.dismissttl); clearTimeout(this.dismissttl);
this.ntf.classList.remove("ns-show"); this.ntf.classList.remove("ns-show");
@ -131,7 +131,7 @@
this.ntf.classList.add("ns-hide"); this.ntf.classList.add("ns-hide");
// callback // callback
this.options.onClose(); if (close) this.options.onClose();
}, 25); }, 25);
// after animation ends remove ntf from the DOM // after animation ends remove ntf from the DOM