Fix erroneously disabled "Empty Trash" (recent regression)
This commit is contained in:
parent
865b3e0b21
commit
6b58d3e2af
2 changed files with 16 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue