Fixed a bug where the alert list would extend endlessly with WebSockets disabled or if a user has too many alerts.

Fixed a bug where the wrong alerts would be removed if a alert dismissal event is received for an alert which isn't in the client cache.
This commit is contained in:
Azareal 2018-09-09 12:15:53 +10:00
parent a13b575b72
commit 01040b200d
1 changed files with 3 additions and 0 deletions

View File

@ -112,6 +112,8 @@ function loadAlerts(menuAlerts) {
setAlertError(menuAlerts,data.errmsg) setAlertError(menuAlerts,data.errmsg)
return; return;
} }
alertList = [];
alertMapping = {};
for(var i in data.msgs) { for(var i in data.msgs) {
addAlert(data.msgs[i]); addAlert(data.msgs[i]);
} }
@ -214,6 +216,7 @@ function runWebSockets() {
index = i; index = i;
} }
} }
if(index==-1) return;
for(var i = index; (i+1) < alertList.length; i++) { for(var i = index; (i+1) < alertList.length; i++) {
alertList[i] = alertList[i+1]; alertList[i] = alertList[i+1];