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

Unified Diff: messageResponder.js

Issue 29338595: Issue 3829 - Merge add-subscriptions and subscriptions.add messages (Closed)
Patch Set: Addressed comments Created March 18, 2016, 11:34 a.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 | « background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -132,14 +132,6 @@
switch (message.type)
{
- case "add-subscription":
- ext.showOptions(function()
- {
- var subscription = Subscription.fromURL(message.url);
- subscription.title = message.title;
- onFilterChange("addSubscription", subscription);
- });
- break;
case "app.get":
if (message.what == "issues")
{
@@ -299,22 +291,27 @@
callback(Prefs[message.key]);
break;
case "subscriptions.add":
- if (message.url in FilterStorage.knownSubscriptions)
- return;
-
var subscription = Subscription.fromURL(message.url);
- if (!subscription)
- return;
-
- subscription.disabled = false;
if ("title" in message)
subscription.title = message.title;
if ("homepage" in message)
subscription.homepage = message.homepage;
- FilterStorage.addSubscription(subscription);
- if (subscription instanceof DownloadableSubscription && !subscription.lastDownload)
- Synchronizer.execute(subscription);
+ if (message.confirm)
+ {
+ ext.showOptions(function()
+ {
+ onFilterChange("addSubscription", subscription);
+ });
+ }
+ else
+ {
+ subscription.disabled = false;
+ FilterStorage.addSubscription(subscription);
+
+ if (subscription instanceof DownloadableSubscription && !subscription.lastDownload)
+ Synchronizer.execute(subscription);
+ }
break;
case "subscriptions.get":
var subscriptions = FilterStorage.subscriptions.filter(function(s)
« no previous file with comments | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld