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

Unified Diff: messageResponder.js

Issue 29333819: Issue 2375 - Implement "Blocking lists" section in new options page (Closed)
Patch Set: Created Jan. 29, 2016, 6:54 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
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -47,7 +47,7 @@
}
var convertSubscription = convertObject.bind(null, ["disabled",
- "downloadStatus", "homepage", "lastSuccess", "title", "url"]);
+ "downloadStatus", "homepage", "lastDownload", "title", "url"]);
var convertFilter = convertObject.bind(null, ["text"]);
var changeListeners = null;
@@ -333,8 +333,17 @@
break;
case "subscriptions.toggle":
var subscription = Subscription.fromURL(message.url);
- if (subscription.url in FilterStorage.knownSubscriptions && !subscription.disabled)
- FilterStorage.removeSubscription(subscription);
+ if (subscription.url in FilterStorage.knownSubscriptions)
+ {
+ if (subscription.disabled || message.keepInstalled)
+ {
+ subscription.disabled = !subscription.disabled;
+ FilterNotifier.triggerListeners("subscription.disabled",
+ subscription);
+ }
+ else
+ FilterStorage.removeSubscription(subscription);
+ }
else
{
subscription.disabled = false;
@@ -345,6 +354,16 @@
Synchronizer.execute(subscription);
}
break;
+ case "subscriptions.update":
+ var subscriptions = message.url ? [Subscription.fromURL(message.url)] :
+ FilterStorage.subscriptions;
+ for (var i = 0; i < subscriptions.length; i++)
+ {
+ var subscription = subscriptions[i];
+ if (subscription instanceof DownloadableSubscription)
+ Synchronizer.execute(subscription, true);
+ }
+ break;
}
});
})(this);

Powered by Google App Engine
This is Rietveld