From bc141ce36b771da11de28b8e46b77dd128acc3dc Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 31 Mar 2018 03:52:17 -0400 Subject: [PATCH] Add .allowsLinkedFiles property to Zotero.Library objects --- chrome/content/zotero/xpcom/data/feed.js | 4 ++++ chrome/content/zotero/xpcom/data/group.js | 4 ++++ chrome/content/zotero/xpcom/data/library.js | 4 ++++ test/tests/libraryTest.js | 11 +++++++++++ 4 files changed, 23 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/feed.js b/chrome/content/zotero/xpcom/data/feed.js index 9a4baec33..d8ee28c16 100644 --- a/chrome/content/zotero/xpcom/data/feed.js +++ b/chrome/content/zotero/xpcom/data/feed.js @@ -111,6 +111,10 @@ Zotero.defineProperty(Zotero.Feed.prototype, 'isFeed', { value: true }); +Zotero.defineProperty(Zotero.Feed.prototype, 'allowsLinkedFiles', { + value: false +}); + Zotero.defineProperty(Zotero.Feed.prototype, 'libraryTypes', { value: Object.freeze(Zotero.Feed._super.prototype.libraryTypes.concat(['feed'])) }); diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js index 596fed825..3b9d8d44d 100644 --- a/chrome/content/zotero/xpcom/data/group.js +++ b/chrome/content/zotero/xpcom/data/group.js @@ -86,6 +86,10 @@ Zotero.defineProperty(Zotero.Group.prototype, 'id', { set: function(v) { return this.groupID = v; } }); +Zotero.defineProperty(Zotero.Group.prototype, 'allowsLinkedFiles', { + value: false +}); + // Create accessors (function() { let accessors = ['name', 'description', 'version']; diff --git a/chrome/content/zotero/xpcom/data/library.js b/chrome/content/zotero/xpcom/data/library.js index 153fd5a7d..79ea829bd 100644 --- a/chrome/content/zotero/xpcom/data/library.js +++ b/chrome/content/zotero/xpcom/data/library.js @@ -190,6 +190,10 @@ Zotero.defineProperty(Zotero.Library.prototype, 'hasTrash', { value: true }); +Zotero.defineProperty(Zotero.Library.prototype, 'allowsLinkedFiles', { + value: true +}); + // Create other accessors (function() { let accessors = ['editable', 'filesEditable', 'storageVersion', 'archived']; diff --git a/test/tests/libraryTest.js b/test/tests/libraryTest.js index a455728ff..a117928ed 100644 --- a/test/tests/libraryTest.js +++ b/test/tests/libraryTest.js @@ -126,6 +126,17 @@ describe("Zotero.Library", function() { }); }); + describe("#allowsLinkedFiles", function () { + it("should return true for personal library", function () { + assert.isTrue(Zotero.Libraries.userLibrary.allowsLinkedFiles); + }); + + it("should return false for group libraries", async function () { + var group = await getGroup(); + assert.isFalse(group.allowsLinkedFiles); + }); + }); + describe("#archived", function() { it("should return archived status", function() { let library = Zotero.Libraries.get(Zotero.Libraries.userLibraryID);