[Pkg-mozext-commits] [adblock-plus] 44/74: Issue 2757 - Fix timing issue resetting notification data while loading preferences
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 12:07:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit e89b9d031f6787e506e8f13e8a1f21da6356cdd7
Author: Sebastian Noack <sebastian at adblockplus.org>
Date: Mon Jul 6 18:38:27 2015 +0200
Issue 2757 - Fix timing issue resetting notification data while loading preferences
---
lib/notification.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/lib/notification.js b/lib/notification.js
index c97bc69..0c80f78 100644
--- a/lib/notification.js
+++ b/lib/notification.js
@@ -198,12 +198,6 @@ let Notification = exports.Notification =
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 @@ let Notification = exports.Notification =
{
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 @@ let Notification = exports.Notification =
*/
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();
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list