commit 6b58d3e2af1c46ba1911400f67a43193e19aad7b
parent 865b3e0b21af5aa0fac71e93dc1a7635a1ae168c
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 19 Jan 2012 02:40:46 -0500
Fix erroneously disabled "Empty Trash" (recent regression)
Diffstat:
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -1980,6 +1980,14 @@ Zotero.ItemGroup.prototype.isWithinGroup = function () {
return this.ref && !!this.ref.libraryID;
}
+Zotero.ItemGroup.prototype.isWithinEditableGroup = function () {
+ if (!this.isWithinGroup()) {
+ return false;
+ }
+ var groupID = Zotero.Groups.getGroupIDFromLibraryID(this.ref.libraryID);
+ return Zotero.Groups.get(groupID).editable;
+}
+
Zotero.ItemGroup.prototype.__defineGetter__('editable', function () {
if (this.isTrash() || this.isShare() || this.isBucket()) {
return false;
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -2132,11 +2132,18 @@ var ZoteroPane = new function()
// Disable some actions if user doesn't have write access
//
// Some actions are disabled via their commands in onCollectionSelected()
- var s = [m.newSubcollection, m.editSelectedCollection, m.removeCollection, m.emptyTrash];
+ var s = [m.newSubcollection, m.editSelectedCollection, m.removeCollection];
if (itemGroup.isWithinGroup() && !itemGroup.editable && !itemGroup.isDuplicates() && !itemGroup.isUnfiled()) {
disable = disable.concat(s);
}
+ // If within non-editable group or trash it empty, disable Empty Trash
+ if (itemGroup.isTrash()) {
+ if ((itemGroup.isWithinGroup() && !itemGroup.isWithinEditableGroup()) || !this.itemsView.rowCount) {
+ disable.push(m.emptyTrash);
+ }
+ }
+
// Hide and enable all actions by default (so if they're shown they're enabled)
for each(var pos in m) {
menu.childNodes[pos].setAttribute('hidden', true);