Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/notification.js

Issue 29321425: Issue 2757 - Fix timing issue resetting notification data while loading preferences (Closed)
Patch Set: Created July 6, 2015, 4:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld