| Index: lib/notification.js |
| =================================================================== |
| --- a/lib/notification.js |
| +++ b/lib/notification.js |
| @@ -198,12 +198,6 @@ |
| if (typeof Prefs.notificationdata.data == "object" && Prefs.notificationdata.data.notifications instanceof Array) |
| remoteData = Prefs.notificationdata.data.notifications; |
| - if (!(Prefs.notificationdata.shown instanceof Array)) |
| - { |
| - Prefs.notificationdata.shown = []; |
| - saveNotificationData(); |
| - } |
| - |
| let notifications = localData.concat(remoteData); |
| if (notifications.length === 0) |
| return null; |
| @@ -214,8 +208,10 @@ |
| { |
| if (typeof notification.type === "undefined" || notification.type !== "critical") |
| { |
| - if (Prefs.notificationdata.shown.indexOf(notification.id) !== -1 |
| - || Prefs.notifications_ignoredcategories.indexOf("*") !== -1) |
| + let shown = Prefs.notificationdata.shown; |
| + if (shown instanceof Array && shown.indexOf(notification.id) != -1) |
| + continue; |
| + if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) |
| continue; |
| } |
| @@ -277,10 +273,14 @@ |
| */ |
| markAsShown: function(id) |
| { |
| - if (Prefs.notificationdata.shown.indexOf(id) > -1) |
| + var data = Prefs.notificationdata; |
| + |
| + if (!(data.shown instanceof Array)) |
| + data.shown = []; |
| + if (data.shown.indexOf(id) != -1) |
| return; |
| - Prefs.notificationdata.shown.push(id); |
| + data.shown.push(id); |
| saveNotificationData(); |
| }, |