diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index 7ccdb8eb4..9bc59477d 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -645,18 +645,15 @@ Zotero.Collection.prototype.fromJSON = Zotero.Promise.coroutine(function* (json) }); -Zotero.Collection.prototype.toJSON = function (options, patch) { +Zotero.Collection.prototype.toJSON = Zotero.Promise.coroutine(function* (options) { var obj = {}; - if (options && options.includeKey) { - obj.collectionKey = this.key; - } - if (options && options.includeVersion) { - obj.collectionVersion = this.version; - } + obj.key = this.key; + obj.version = this.version; obj.name = this.name; obj.parentCollection = this.parentKey ? this.parentKey : false; + obj.relations = {}; // TEMP return obj; -} +}); /** diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index c4316c75f..338b4febe 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -772,22 +772,6 @@ Zotero.Search.prototype.search = Zotero.Promise.coroutine(function* (asTempTable }); -Zotero.Search.prototype.serialize = function() { - var obj = { - primary: { - id: this.id, - libraryID: this.libraryID, - key: this.key - }, - fields: { - name: this.name, - }, - conditions: this.getConditions() - }; - return obj; -} - - Zotero.Search.prototype.fromJSON = Zotero.Promise.coroutine(function* (json) { yield this.loadAllData(); @@ -807,6 +791,17 @@ Zotero.Search.prototype.fromJSON = Zotero.Promise.coroutine(function* (json) { }); +Zotero.Search.prototype.toJSON = Zotero.Promise.coroutine(function* (options) { + var obj = {}; + obj.key = this.key; + obj.version = this.version; + obj.name = this.name; + yield this.loadConditions(); + obj.conditions = this.getConditions(); + return obj; +}); + + /* * Get the SQL string for the search */