Index: lib/notification.js |
diff --git a/lib/notification.js b/lib/notification.js |
index 51ed5091da72b4ceb6a87d21cd60a6e7fd1af124..7800469d02d74bb86bf6b17843204cfefc39c6f2 100644 |
--- a/lib/notification.js |
+++ b/lib/notification.js |
@@ -33,7 +33,8 @@ var EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; |
var TYPE = { |
information: 0, |
question: 1, |
- critical: 2 |
+ relentless: 2, |
+ critical: 3 |
}; |
var showListeners = []; |
@@ -208,10 +209,22 @@ var Notification = exports.Notification = |
{ |
if (typeof notification.type === "undefined" || notification.type !== "critical") |
{ |
- let shown = Prefs.notificationdata.shown; |
- if (shown instanceof Array && shown.indexOf(notification.id) != -1) |
- continue; |
- if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) |
+ let shown; |
+ if (typeof Prefs.notificationdata.shown == "object") |
+ shown = Prefs.notificationdata.shown[notification.id]; |
+ |
+ if (typeof shown != "undefined") |
+ { |
+ if (typeof notification.interval == "number") |
+ { |
+ if (shown + notification.interval > Date.now()) |
+ continue; |
+ } |
+ else if (shown) |
+ continue; |
+ } |
+ |
+ if (notification.type !== "relentless" && Prefs.notifications_ignoredcategories.indexOf("*") != -1) |
Felix Dahlke
2017/01/19 17:16:14
:)
wspee
2017/01/20 09:21:40
;)
|
continue; |
} |
@@ -287,14 +300,22 @@ var Notification = exports.Notification = |
*/ |
markAsShown: function(id) |
{ |
- var data = Prefs.notificationdata; |
+ let now = Date.now(); |
+ let data = Prefs.notificationdata; |
- if (!(data.shown instanceof Array)) |
- data.shown = []; |
- if (data.shown.indexOf(id) != -1) |
- return; |
+ if (data.shown instanceof Array) |
+ { |
+ let newShown = {}; |
+ for (let oldId of data.shown) |
+ newShown[oldId] = now; |
+ data.shown = newShown; |
+ } |
+ |
+ if (typeof data.shown != "object") |
+ data.shown = {}; |
+ |
+ data.shown[id] = now; |
- data.shown.push(id); |
saveNotificationData(); |
}, |