Disable Import actions in uneditable libraries (#2471)

This commit is contained in:
Abe Jellinek 2022-04-11 13:12:43 -07:00 committed by GitHub
parent ad36c9fb2a
commit b8b1f8be55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1294,8 +1294,8 @@ var ZoteroPane = new function()
if (this.itemsView && this.itemsView.collectionTreeRow && this.itemsView.collectionTreeRow.id == collectionTreeRow.id) {
Zotero.debug("ZoteroPane.onCollectionSelected: Collection selection hasn't changed");
// Update toolbar, in case editability has changed
this._updateToolbarIconsForRow(collectionTreeRow);
// Update enabled actions, in case editability has changed
this._updateEnabledActionsForRow(collectionTreeRow);
return;
}
@ -1315,7 +1315,7 @@ var ZoteroPane = new function()
collectionTreeRow.setTags(ZoteroPane.tagSelector.getTagSelection());
}
this._updateToolbarIconsForRow(collectionTreeRow);
this._updateEnabledActionsForRow(collectionTreeRow);
// If item data not yet loaded for library, load it now.
// Other data types are loaded at startup
@ -1336,12 +1336,14 @@ var ZoteroPane = new function()
/**
* Enable or disable toolbar icons and menu options as necessary
* Enable or disable toolbar icons, menu options, and commands as necessary
*/
this._updateToolbarIconsForRow = function (collectionTreeRow) {
this._updateEnabledActionsForRow = function (collectionTreeRow) {
const disableIfNoEdit = [
"cmd_zotero_newCollection",
"cmd_zotero_newSavedSearch",
"cmd_zotero_import",
"cmd_zotero_importFromClipboard",
"zotero-tb-add",
"menu_newItem",
"zotero-tb-lookup",