Don't include collections in child item JSON export
But handle it in Zotero.Items.diff() if it's there for one item
This commit is contained in:
parent
a4e6e96d3c
commit
1f8b6fad61
2 changed files with 8 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue