Return false for group.filesEditable if group.editable is false
It's possible for filesEditable in the DB to be set to 1 even if editable is 0. We generally check editable first anyway, but let's be safe. Also make editable/filesEditable return booleans instead of numbers
This commit is contained in:
parent
b09daebbde
commit
c78f8b8e77
2 changed files with 3 additions and 7 deletions
|
@ -59,7 +59,7 @@ Zotero.Group.prototype.__defineGetter__('description', function () { return this
|
|||
Zotero.Group.prototype.__defineSetter__('description', function (val) { this._set('description', val); });
|
||||
Zotero.Group.prototype.__defineGetter__('editable', function () { return this._get('editable'); });
|
||||
Zotero.Group.prototype.__defineSetter__('editable', function (val) { this._set('editable', val); });
|
||||
Zotero.Group.prototype.__defineGetter__('filesEditable', function () { return this._get('filesEditable'); });
|
||||
Zotero.Group.prototype.__defineGetter__('filesEditable', function () { if (!this.editable) { return false; } return this._get('filesEditable'); });
|
||||
Zotero.Group.prototype.__defineSetter__('filesEditable', function (val) { this._set('filesEditable', val); });
|
||||
|
||||
|
||||
|
@ -146,8 +146,8 @@ Zotero.Group.prototype.loadFromRow = function(row) {
|
|||
this._libraryID = row.libraryID;
|
||||
this._name = row.name;
|
||||
this._description = row.description;
|
||||
this._editable = row.editable;
|
||||
this._filesEditable = row.filesEditable;
|
||||
this._editable = !!row.editable;
|
||||
this._filesEditable = !!row.filesEditable;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -93,10 +93,6 @@ Zotero.Libraries = new function () {
|
|||
|
||||
|
||||
this.isFilesEditable = function (libraryID) {
|
||||
if (!this.isEditable(libraryID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = this.getType(libraryID);
|
||||
switch (type) {
|
||||
case 'user':
|
||||
|
|
Loading…
Reference in a new issue