diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 9cb8758112..66977ff85a 100644 --- 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 index d90c7cfece..70a6ec588c 100644 --- 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);