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: Created March 17, 2016, 9:20 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
« background.js ('K') | « 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,24 @@
callback(Prefs[message.key]);
break;
case "subscriptions.add":
- if (message.url in FilterStorage.knownSubscriptions)
Sebastian Noack 2016/03/17 21:41:17 This check seems like a bug to me. If I understand
Thomas Greiner 2016/03/18 10:48:20 No, you're probably thinking about `Filter.knownFi
Sebastian Noack 2016/03/18 11:35:07 You're right. However, FilterStorage.addSubscripti
Thomas Greiner 2016/03/18 13:20:39 I see what you mean. Seems to be more of a design
- return;
-
var subscription = Subscription.fromURL(message.url);
- if (!subscription)
Sebastian Noack 2016/03/17 21:41:17 Subscription.fromURL() never returns null or simil
Thomas Greiner 2016/03/18 10:48:20 You're right, nice catch.
- 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.ask)
Thomas Greiner 2016/03/18 10:48:20 Detail: Just a personal preference but what do you
Sebastian Noack 2016/03/18 11:35:07 Fine with me.
+ {
+ ext.showOptions(onFilterChange.bind(null, "addSubscription", subscription));
Thomas Greiner 2016/03/18 10:48:20 Coding style: Mind the maximum line length.
Sebastian Noack 2016/03/18 11:35:07 Done.
+ }
+ 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)
« background.js ('K') | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld