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 () {