Don't send inPublications=false in 'full' mode for group items

This commit is contained in:
Dan Stillman 2017-11-20 16:27:45 -05:00
parent f0b7a212e5
commit 88a6e4f79f
2 changed files with 12 additions and 3 deletions

View file

@ -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;
}

View file

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