commit bc141ce36b771da11de28b8e46b77dd128acc3dc
parent 20df18636d5f801d47808a7b0b9387efd9de0c69
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 31 Mar 2018 03:52:17 -0400
Add .allowsLinkedFiles property to Zotero.Library objects
Diffstat:
4 files changed, 23 insertions(+), 0 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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);