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

Unified Diff: new-options.js

Issue 29557727: Issue 5802 - Handle custom subscription creation (Closed)
Patch Set: Created Sept. 27, 2017, 7:45 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: new-options.js
===================================================================
--- a/new-options.js
+++ b/new-options.js
@@ -449,6 +449,15 @@
filtersMap[filter.text] = filter;
}
+ function loadCustomFilters(filters)
+ {
+ for (let filter of filters)
+ updateFilter(filter);
+
+ setCustomFiltersView("read");
+ isCustomFiltersLoaded = true;
+ }
+
function removeCustomFilter(text)
{
let index = customFilters.indexOf(text);
@@ -1055,6 +1064,7 @@
for (let property in collections)
collections[property].clearAll();
+ setCustomFiltersView("empty");
ext.backgroundPage.sendMessage({
type: "subscriptions.get",
special: true
@@ -1070,11 +1080,7 @@
},
(filters) =>
{
- for (let filter of filters)
- updateFilter(filter);
-
- isCustomFiltersLoaded = true;
- setCustomFiltersView("read");
+ loadCustomFilters(filters);
});
}
});
@@ -1210,7 +1216,13 @@
break;
case "added":
let {url, recommended} = subscription;
- if (url in subscriptionsMap)
+ // Handle custom subscription
+ if (/^~user/.test(url))
saroyanm 2017/09/27 20:05:41 I don't think there is an easy way to check if thi
+ {
+ loadCustomFilters(subscription.filters);
+ return;
+ }
+ else if (url in subscriptionsMap)
updateSubscription(subscription);
else
addSubscription(subscription);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld