commit 88a6e4f79fa5f8e69612c6e521aa29fe53715ca3
parent f0b7a212e5670804c9b879d44ec34a4d19a91170
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 20 Nov 2017 16:27:45 -0500
Don't send inPublications=false in 'full' mode for group items
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -4347,7 +4347,9 @@ Zotero.Item.prototype.toJSON = function (options = {}) {
}
// My Publications
- if (this._inPublications || mode == 'full') {
+ if (this._inPublications
+ // Include in 'full' mode, but only in My Library
+ || (mode == 'full' && this.library && this.library.libraryType == 'user')) {
obj.inPublications = this._inPublications;
}
diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js
@@ -1369,11 +1369,18 @@ describe("Zotero.Item", function () {
assert.notProperty(json, "inPublications");
});
- it("should include inPublications=false for items not in My Publications in full mode", function* () {
- var item = createUnsavedDataObject('item');
+ it("should include inPublications=false for personal-library items not in My Publications in full mode", async function () {
+ var item = createUnsavedDataObject('item', { libraryID: Zotero.Libraries.userLibraryID });
var json = item.toJSON({ mode: 'full' });
assert.property(json, "inPublications", false);
});
+
+ it("shouldn't include inPublications=false for group items not in My Publications in full mode", function* () {
+ var group = yield getGroup();
+ var item = createUnsavedDataObject('item', { libraryID: group.libraryID });
+ var json = item.toJSON({ mode: 'full' });
+ assert.notProperty(json, "inPublications");
+ });
})
describe("'full' mode", function () {