Allow to use Infinity for an alert duration

This commit is contained in:
Yohan Boniface 2023-05-31 16:16:31 +02:00
parent 69bf6593ac
commit 7f2545f09b
2 changed files with 7 additions and 5 deletions

View file

@ -1339,7 +1339,7 @@ L.U.Map.include({
let duration = 3000,
alert = { content: L._('Map has been saved!'), level: 'info' }
if (!this.options.umap_id) {
alert.duration = 100000 // we want a longer message at map creation (TODO UGLY)
alert.duration = Infinity
this.options.umap_id = data.id
this.permissions.setOptions(data.permissions)
if (data.permissions && data.permissions.anonymous_edit_url) {

View file

@ -124,10 +124,12 @@ L.U.UI = L.Evented.extend({
)
}
}
self.ALERT_ID = timeoutID = window.setTimeout(
L.bind(close, this),
e.duration || 3000
)
if (e.duration !== Infinity) {
this.ALERT_ID = timeoutID = window.setTimeout(
L.bind(close, this),
e.duration || 3000
)
}
},
tooltip: function (e) {