Add .allowsLinkedFiles property to Zotero.Library objects

This commit is contained in:
Dan Stillman 2018-03-31 03:52:17 -04:00
parent 20df18636d
commit bc141ce36b
4 changed files with 23 additions and 0 deletions

View file

@ -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']))
});

View file

@ -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'];

View file

@ -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'];

View file

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