mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-22635] Only Show Assign to Collections Bulk Menu Option When Item Selected Is Editable (#15217)
* assign to collections option in bulk menu only shows when editable item selected and user has editable collections
This commit is contained in:
@@ -382,19 +382,22 @@ export class VaultItemsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.selection.selected.length === 0) {
|
if (this.selection.selected.length === 0) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasPersonalItems = this.hasPersonalItems();
|
const hasPersonalItems = this.hasPersonalItems();
|
||||||
const uniqueCipherOrgIds = this.getUniqueOrganizationIds();
|
const uniqueCipherOrgIds = this.getUniqueOrganizationIds();
|
||||||
|
const hasEditableCollections = this.allCollections.some((collection) => {
|
||||||
|
return !collection.readOnly;
|
||||||
|
});
|
||||||
|
|
||||||
// Return false if items are from different organizations
|
// Return false if items are from different organizations
|
||||||
if (uniqueCipherOrgIds.size > 1) {
|
if (uniqueCipherOrgIds.size > 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all items are personal, return based on personal items
|
// If all selected items are personal, return based on personal items
|
||||||
if (uniqueCipherOrgIds.size === 0) {
|
if (uniqueCipherOrgIds.size === 0 && hasEditableCollections) {
|
||||||
return hasPersonalItems;
|
return hasPersonalItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,7 +409,11 @@ export class VaultItemsComponent {
|
|||||||
const collectionNotSelected =
|
const collectionNotSelected =
|
||||||
this.selection.selected.filter((item) => item.collection).length === 0;
|
this.selection.selected.filter((item) => item.collection).length === 0;
|
||||||
|
|
||||||
return (canEditOrManageAllCiphers || this.allCiphersHaveEditAccess()) && collectionNotSelected;
|
return (
|
||||||
|
(canEditOrManageAllCiphers || this.allCiphersHaveEditAccess()) &&
|
||||||
|
collectionNotSelected &&
|
||||||
|
hasEditableCollections
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user