mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
[AC-1139] Fixed CanDelete logic
This commit is contained in:
@@ -109,10 +109,7 @@
|
|||||||
{{ "cancel" | i18n }}
|
{{ "cancel" | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
*ngIf="
|
*ngIf="canDelete$ | async"
|
||||||
editMode &&
|
|
||||||
((flexibleCollectionsEnabled$ | async) || organization?.canDeleteAssignedCollections)
|
|
||||||
"
|
|
||||||
type="button"
|
type="button"
|
||||||
bitIconButton="bwi-trash"
|
bitIconButton="bwi-trash"
|
||||||
buttonType="danger"
|
buttonType="danger"
|
||||||
|
|||||||
@@ -316,6 +316,14 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
this.close(CollectionDialogAction.Deleted, this.collection);
|
this.close(CollectionDialogAction.Deleted, this.collection);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected canDelete$ = this.flexibleCollectionsEnabled$.pipe(
|
||||||
|
switchMap(async (flexibleCollectionsEnabled) => {
|
||||||
|
return (
|
||||||
|
this.editMode && this.collection?.canDelete(this.organization!, flexibleCollectionsEnabled)
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.destroy$.next();
|
this.destroy$.next();
|
||||||
this.destroy$.complete();
|
this.destroy$.complete();
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ export class BulkDeleteDialogComponent {
|
|||||||
// From org vault
|
// From org vault
|
||||||
if (this.organization) {
|
if (this.organization) {
|
||||||
if (
|
if (
|
||||||
(flexibleCollectionsEnabled || !this.organization.canDeleteAssignedCollections) &&
|
(flexibleCollectionsEnabled
|
||||||
|
? this.collections.some((c) => !c.canDelete)
|
||||||
|
: !this.organization.canDeleteAssignedCollections) &&
|
||||||
!this.organization.canDeleteAnyCollection
|
!this.organization.canDeleteAnyCollection
|
||||||
) {
|
) {
|
||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
@@ -151,7 +153,9 @@ export class BulkDeleteDialogComponent {
|
|||||||
const deletePromises: Promise<any>[] = [];
|
const deletePromises: Promise<any>[] = [];
|
||||||
for (const organization of this.organizations) {
|
for (const organization of this.organizations) {
|
||||||
if (
|
if (
|
||||||
(flexibleCollectionsEnabled || !this.organization.canDeleteAssignedCollections) &&
|
(flexibleCollectionsEnabled
|
||||||
|
? this.collections.some((c) => !c.canDelete)
|
||||||
|
: !this.organization.canDeleteAssignedCollections) &&
|
||||||
!organization.canDeleteAnyCollection
|
!organization.canDeleteAnyCollection
|
||||||
) {
|
) {
|
||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
|
|||||||
Reference in New Issue
Block a user