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

Unified Diff: lib/subscriptionClasses.js

Issue 29824575: Issue 6689 - Add type property to Subscription class (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created July 6, 2018, 2:27 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 | test/subscriptionClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/subscriptionClasses.js
===================================================================
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -47,16 +47,22 @@
{
/**
* Download location of the subscription
* @type {string}
*/
url: null,
/**
+ * Type of the subscription
+ * @type {?string}
+ */
+ type: null,
+
+ /**
* Filters contained in the filter subscription
* @type {Filter[]}
*/
filters: null,
_title: null,
_fixedTitle: false,
_disabled: false,
@@ -125,16 +131,18 @@
* Serializes the subscription to an array of strings for writing
* out on the disk.
* @param {string[]} buffer buffer to push the serialization results into
*/
serialize(buffer)
{
buffer.push("[Subscription]");
buffer.push("url=" + this.url);
+ if (this.type)
+ buffer.push("type=" + this.type);
if (this._title)
buffer.push("title=" + this._title);
if (this._fixedTitle)
buffer.push("fixedTitle=true");
if (this._disabled)
buffer.push("disabled=true");
},
@@ -186,16 +194,18 @@
*/
Subscription.fromObject = function(obj)
{
let result;
if (obj.url[0] != "~")
{
// URL is valid - this is a downloadable subscription
result = new DownloadableSubscription(obj.url, obj.title);
+ if ("type" in obj)
+ result.type = obj.type;
if ("downloadStatus" in obj)
result._downloadStatus = obj.downloadStatus;
if ("lastSuccess" in obj)
result.lastSuccess = parseInt(obj.lastSuccess, 10) || 0;
if ("lastCheck" in obj)
result._lastCheck = parseInt(obj.lastCheck, 10) || 0;
if ("expires" in obj)
result.expires = parseInt(obj.expires, 10) || 0;
« no previous file with comments | « no previous file | test/subscriptionClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld