diff --git a/chrome/content/zotero/xpcom/data/library.js b/chrome/content/zotero/xpcom/data/library.js index 70e69b943f..0f16b3b18b 100644 --- a/chrome/content/zotero/xpcom/data/library.js +++ b/chrome/content/zotero/xpcom/data/library.js @@ -48,6 +48,7 @@ Zotero.Library = function(params = {}) { 'libraryVersion', 'storageVersion', 'lastSync', + 'archived' ] ); @@ -68,7 +69,7 @@ Zotero.Library = function(params = {}) { // DB columns Zotero.defineProperty(Zotero.Library, '_dbColumns', { value: Object.freeze([ - 'type', 'editable', 'filesEditable', 'version', 'storageVersion', 'lastSync' + 'type', 'editable', 'filesEditable', 'version', 'storageVersion', 'lastSync', 'archived' ]) }); @@ -195,7 +196,7 @@ Zotero.defineProperty(Zotero.Library.prototype, 'hasTrash', { // Create other accessors (function() { - let accessors = ['editable', 'filesEditable', 'storageVersion']; + let accessors = ['editable', 'filesEditable', 'storageVersion', 'archived']; for (let i=0; i library.archived = true, /^Cannot change _libraryArchived for user library$/, "does not allow setting user library as archived"); + + library = Zotero.Libraries.get(Zotero.Libraries.publicationsLibraryID); + assert.throws(() => library.archived = true, /^Cannot change _libraryArchived for publications library$/, "does not allow setting publications library as archived"); + }); + + it("should only be settable on read-only library", function* () { + let library = yield createGroup(); + assert.throws(() => library.archived = true, /^Cannot set editable library as archived$/); + }); + }); + describe("#save()", function() { it("should require mandatory parameters to be set", function* () { let library = new Zotero.Library({ editable: true, filesEditable: true });