www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1f8b6fad61bc8ea0eb2e27146710d5b0d5897d5a
parent a4e6e96d3cb3b086e0f7698816c246f7884f76b8
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 13 May 2015 10:26:21 -0400

Don't include collections in child item JSON export

But handle it in Zotero.Items.diff() if it's there for one item

Diffstat:
Mchrome/content/zotero/xpcom/data/dataObjects.js | 2++
Mchrome/content/zotero/xpcom/data/item.js | 10++++++----
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js @@ -530,6 +530,8 @@ Zotero.DataObjects.prototype._diffCreators = function (data1, data2) { } Zotero.DataObjects.prototype._diffCollections = function (data1, data2) { + // Child items shouldn't have collections properties, but just in case one does + if (!data2) return false; if (data1.length != data2.length) return false; let c1 = data1.concat(); let c2 = data2.concat(); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -4216,10 +4216,12 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options) { } // Collections - yield this.loadCollections(); - obj.collections = this.getCollections().map(function (id) { - return this.ContainerObjectsClass.getLibraryAndKeyFromID(id).key; - }.bind(this)); + if (this.isTopLevelItem()) { + yield this.loadCollections(); + obj.collections = this.getCollections().map(function (id) { + return this.ContainerObjectsClass.getLibraryAndKeyFromID(id).key; + }.bind(this)); + } // Relations yield this.loadRelations();