From 88a6e4f79fa5f8e69612c6e521aa29fe53715ca3 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 20 Nov 2017 16:27:45 -0500 Subject: [PATCH] Don't send inPublications=false in 'full' mode for group items --- chrome/content/zotero/xpcom/data/item.js | 4 +++- test/tests/itemTest.js | 11 +++++++++-- 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 index 9f6fc10e83..15420beffe 100644 --- 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 index 4c5251e7c2..918947978f 100644 --- 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 () {