www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit c78f8b8e77ca2e64d2639e08ba929f85a7e9deed
parent b09daebbde01fc2a0d36500eeb8e6e0ea6fc6a00
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 30 Apr 2013 18:11:41 -0400

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

Diffstat:
Mchrome/content/zotero/xpcom/data/group.js | 6+++---
Mchrome/content/zotero/xpcom/data/libraries.js | 4----
2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js @@ -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; } diff --git a/chrome/content/zotero/xpcom/data/libraries.js b/chrome/content/zotero/xpcom/data/libraries.js @@ -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':