Index: messageResponder.js |
=================================================================== |
--- a/messageResponder.js |
+++ b/messageResponder.js |
@@ -25,17 +25,19 @@ |
const {Prefs} = require("prefs"); |
const {Utils} = require("utils"); |
const {FilterStorage} = require("filterStorage"); |
const {FilterNotifier} = require("filterNotifier"); |
const {defaultMatcher} = require("matcher"); |
const {Notification: NotificationStorage} = require("notification"); |
const {getActiveNotification, shouldDisplay} = require("notificationHelper"); |
- const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); |
+ const { |
+ Filter, ActiveFilter, BlockingFilter, RegExpFilter |
+ } = require("filterClasses"); |
const {Synchronizer} = require("synchronizer"); |
const info = require("info"); |
const { |
Subscription, |
DownloadableSubscription, |
SpecialSubscription |
} = require("subscriptionClasses"); |
@@ -58,17 +60,19 @@ |
result[key] = obj[key]; |
} |
return result; |
} |
function convertSubscription(subscription) |
{ |
let obj = convertObject(["disabled", "downloadStatus", "homepage", |
- "lastDownload", "title", "url"], subscription); |
+ "version", "lastDownload", "lastSuccess", |
+ "softExpiration", "expires", "title", |
+ "url"], subscription); |
if (subscription instanceof SpecialSubscription) |
obj.filters = subscription.filters.map(convertFilter); |
obj.isDownloading = Synchronizer.isExecuting(subscription.url); |
return obj; |
} |
let convertFilter = convertObject.bind(null, ["text"]); |
@@ -396,17 +400,27 @@ |
return false; |
if (s instanceof DownloadableSubscription && message.downloadable) |
return true; |
if (s instanceof SpecialSubscription && message.special) |
return true; |
return false; |
}); |
- return subscriptions.map(convertSubscription); |
+ return subscriptions.map((s) => |
+ { |
+ let result = convertSubscription(s); |
+ if (message.disabledFilters) |
+ { |
+ result.disabledFilters = s.filters |
kzar
2017/10/24 14:14:18
Does this pass linting? The indentation seems a li
Wladimir Palant
2017/10/24 14:18:59
Yes, it passes linting. I'd normally align the dot
kzar
2017/10/24 14:20:24
Fair enough, it's Thomas' module after all.
Manish Jethani
2017/10/24 14:38:25
How about moving s.filter to the next line with a
Wladimir Palant
2017/10/25 11:05:01
Not convinced that this would be better, so I bett
|
+ .filter((f) => f instanceof ActiveFilter && f.disabled) |
+ .map((f) => f.text); |
+ } |
+ return result; |
+ }); |
}); |
port.on("subscriptions.listen", (message, sender) => |
{ |
getListenerFilters(sender.page).subscription = message.filter; |
addFilterListeners("subscription", message.filter); |
}); |