1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-31 07:33:23 +00:00

[PM-17154] Limit item deletion feature flag removal (#15094)

* Refactor components to remove limitItemDeletion feature flag usage

This commit simplifies the logic in various components by removing the limitItemDeletion feature flag. The conditions for displaying restore and delete actions are now based solely on the cipher's permissions, enhancing code clarity and maintainability.

* Refactor cipher deletion logic to remove the feature flag and collection ID dependency

This commit updates the cipher deletion logic across multiple components and services by removing the unnecessary dependency on collection IDs. The `canDeleteCipher$` method now solely relies on the cipher's permissions, simplifying the code and improving maintainability.

* Remove LimitItemDeletion feature flag from feature-flag enum and default values

* Remove configService from ServiceContainer and MainBackground constructor parameters

* Remove configService from RestoreCommand instantiation in OssServeConfigurator and VaultProgram classes
This commit is contained in:
Rui Tomé
2025-06-10 09:57:34 +01:00
committed by GitHub
parent 159cca8cfa
commit b5bddd0b06
26 changed files with 55 additions and 339 deletions

View File

@@ -1325,7 +1325,6 @@ export default class MainBackground {
this.collectionService,
this.organizationService,
this.accountService,
this.configService,
);
this.inlineMenuFieldQualificationService = new InlineMenuFieldQualificationService();

View File

@@ -17,11 +17,7 @@
</button>
<button
*ngIf="
(limitItemDeletion$ | async)
? cipher.isDeleted && cipher.permissions.restore
: cipher.isDeleted && cipher.edit
"
*ngIf="cipher.isDeleted && cipher.permissions.restore"
buttonType="primary"
type="button"
bitButton

View File

@@ -5,7 +5,7 @@ import { Component } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { FormsModule } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom, map, Observable, switchMap } from "rxjs";
import { firstValueFrom, Observable, switchMap, of } from "rxjs";
import { CollectionView } from "@bitwarden/admin-console/common";
import { JslibModule } from "@bitwarden/angular/jslib.module";
@@ -22,8 +22,6 @@ import {
UPDATE_PASSWORD,
} from "@bitwarden/common/autofill/constants";
import { EventType } from "@bitwarden/common/enums";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { UserId } from "@bitwarden/common/types/guid";
@@ -112,7 +110,6 @@ export class ViewV2Component {
loadAction: LoadAction;
senderTabId?: number;
protected limitItemDeletion$ = this.configService.getFeatureFlag$(FeatureFlag.LimitItemDeletion);
protected showFooter$: Observable<boolean>;
constructor(
@@ -131,7 +128,6 @@ export class ViewV2Component {
protected cipherAuthorizationService: CipherAuthorizationService,
private copyCipherFieldService: CopyCipherFieldService,
private popupScrollPositionService: VaultPopupScrollPositionService,
private configService: ConfigService,
) {
this.subscribeToParams();
}
@@ -160,17 +156,10 @@ export class ViewV2Component {
this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(cipher);
this.showFooter$ = this.limitItemDeletion$.pipe(
map((enabled) => {
if (enabled) {
return (
cipher &&
(!cipher.isDeleted ||
(cipher.isDeleted && (cipher.permissions.restore || cipher.permissions.delete)))
);
}
return this.showFooterLegacy();
}),
this.showFooter$ = of(
cipher &&
(!cipher.isDeleted ||
(cipher.isDeleted && (cipher.permissions.restore || cipher.permissions.delete))),
);
await this.eventCollectionService.collect(
@@ -268,15 +257,6 @@ export class ViewV2Component {
: this.cipherService.softDeleteWithServer(this.cipher.id, this.activeUserId);
}
//@TODO: remove this when the LimitItemDeletion feature flag is removed
protected showFooterLegacy(): boolean {
return (
this.cipher &&
(!this.cipher.isDeleted ||
(this.cipher.isDeleted && this.cipher.edit && this.cipher.viewPassword))
);
}
/**
* Handles the load action for the view vault item popout. These actions are typically triggered
* via the extension context menu. It is necessary to render the view for items that have password

View File

@@ -31,14 +31,7 @@
></i>
<span slot="secondary">{{ cipher.subTitle }}</span>
</button>
<ng-container
slot="end"
*ngIf="
(limitItemDeletion$ | async)
? cipher.permissions.restore
: cipher.edit && cipher.viewPassword
"
>
<ng-container slot="end" *ngIf="cipher.permissions.restore">
<bit-item-action>
<button
type="button"

View File

@@ -8,8 +8,6 @@ import { firstValueFrom } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { CipherId } from "@bitwarden/common/types/guid";
@@ -70,11 +68,8 @@ export class TrashListItemsContainerComponent {
private passwordRepromptService: PasswordRepromptService,
private accountService: AccountService,
private router: Router,
private configService: ConfigService,
) {}
protected limitItemDeletion$ = this.configService.getFeatureFlag$(FeatureFlag.LimitItemDeletion);
/**
* The tooltip text for the organization icon for ciphers that belong to an organization.
*/