1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-08 05:47:50 +02:00

[pm-10995] feature flag removal (#11000)

* Removing feature flag

* Removing flag from feature-flag.enum.ts

* suggested changes

* prettier

* fixing merge conflict issue

* Removing unused code

* suggested change from Gbubemi

* Adding back merge conflict code

* fixing prettier styling
This commit is contained in:
cd-bitwarden 2024-10-02 12:55:54 -04:00 committed by GitHub
parent 21a4b48eca
commit a23991a64b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 18 additions and 192 deletions

View File

@ -106,12 +106,7 @@
</a> </a>
</ng-container> </ng-container>
<button <button bitMenuItem *ngIf="showAttachments" type="button" (click)="attachments()">
bitMenuItem
*ngIf="showAttachments || !vaultBulkManagementActionEnabled"
type="button"
(click)="attachments()"
>
<i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i>
{{ "attachments" | i18n }} {{ "attachments" | i18n }}
</button> </button>
@ -119,26 +114,6 @@
<i class="bwi bwi-fw bwi-files" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-files" aria-hidden="true"></i>
{{ "clone" | i18n }} {{ "clone" | i18n }}
</button> </button>
<!-- This option will be phased out in future releases -->
<button
bitMenuItem
*ngIf="!cipher.organizationId && !cipher.isDeleted && !vaultBulkManagementActionEnabled"
type="button"
(click)="moveToOrganization()"
>
<i class="bwi bwi-fw bwi-arrow-circle-right" aria-hidden="true"></i>
{{ "moveToOrganization" | i18n }}
</button>
<!-- This option will be phased out in future releases -->
<button
bitMenuItem
*ngIf="cipher.organizationId && !cipher.isDeleted && !vaultBulkManagementActionEnabled"
type="button"
(click)="editCollections()"
>
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
{{ "collections" | i18n }}
</button>
<button <button
bitMenuItem bitMenuItem
*ngIf="showAssignToCollections" *ngIf="showAssignToCollections"
@ -156,12 +131,7 @@
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
{{ "restore" | i18n }} {{ "restore" | i18n }}
</button> </button>
<button <button bitMenuItem *ngIf="canEditCipher" (click)="deleteCipher()" type="button">
bitMenuItem
*ngIf="canEditCipher || !vaultBulkManagementActionEnabled"
(click)="deleteCipher()"
type="button"
>
<span class="tw-text-danger"> <span class="tw-text-danger">
<i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i>
{{ (cipher.isDeleted ? "permanentlyDelete" : "delete") | i18n }} {{ (cipher.isDeleted ? "permanentlyDelete" : "delete") | i18n }}

View File

@ -35,7 +35,6 @@ export class VaultCipherRowComponent implements OnInit {
@Input() collections: CollectionView[]; @Input() collections: CollectionView[];
@Input() viewingOrgVault: boolean; @Input() viewingOrgVault: boolean;
@Input() canEditCipher: boolean; @Input() canEditCipher: boolean;
@Input() vaultBulkManagementActionEnabled: boolean;
@Output() onEvent = new EventEmitter<VaultItemEvent>(); @Output() onEvent = new EventEmitter<VaultItemEvent>();
@ -100,17 +99,15 @@ export class VaultCipherRowComponent implements OnInit {
} }
protected get disableMenu() { protected get disableMenu() {
return ( return !(
!( this.isNotDeletedLoginCipher ||
this.isNotDeletedLoginCipher || this.showCopyPassword ||
this.showCopyPassword || this.showCopyTotp ||
this.showCopyTotp || this.showLaunchUri ||
this.showLaunchUri || this.showAttachments ||
this.showAttachments || this.showClone ||
this.showClone || this.canEditCipher ||
this.canEditCipher || this.cipher.isDeleted
this.cipher.isDeleted
) && this.vaultBulkManagementActionEnabled
); );
} }
@ -122,14 +119,6 @@ export class VaultCipherRowComponent implements OnInit {
this.onEvent.emit({ type: "clone", item: this.cipher }); this.onEvent.emit({ type: "clone", item: this.cipher });
} }
protected moveToOrganization() {
this.onEvent.emit({ type: "moveToOrganization", items: [this.cipher] });
}
protected editCollections() {
this.onEvent.emit({ type: "viewCipherCollections", item: this.cipher });
}
protected events() { protected events() {
this.onEvent.emit({ type: "viewEvents", item: this.cipher }); this.onEvent.emit({ type: "viewEvents", item: this.cipher });
} }

View File

@ -5,7 +5,6 @@ import { VaultItem } from "./vault-item";
export type VaultItemEvent = export type VaultItemEvent =
| { type: "viewAttachments"; item: CipherView } | { type: "viewAttachments"; item: CipherView }
| { type: "viewCipherCollections"; item: CipherView }
| { type: "bulkEditCollectionAccess"; items: CollectionView[] } | { type: "bulkEditCollectionAccess"; items: CollectionView[] }
| { type: "viewCollectionAccess"; item: CollectionView; readonly: boolean } | { type: "viewCollectionAccess"; item: CollectionView; readonly: boolean }
| { type: "viewEvents"; item: CipherView } | { type: "viewEvents"; item: CipherView }
@ -15,5 +14,4 @@ export type VaultItemEvent =
| { type: "delete"; items: VaultItem[] } | { type: "delete"; items: VaultItem[] }
| { type: "copyField"; item: CipherView; field: "username" | "password" | "totp" } | { type: "copyField"; item: CipherView; field: "username" | "password" | "totp" }
| { type: "moveToFolder"; items: CipherView[] } | { type: "moveToFolder"; items: CipherView[] }
| { type: "moveToOrganization"; items: CipherView[] }
| { type: "assignToCollections"; items: CipherView[] }; | { type: "assignToCollections"; items: CipherView[] };

View File

@ -38,7 +38,7 @@
<bit-menu #headerMenu> <bit-menu #headerMenu>
<button *ngIf="bulkMoveAllowed" type="button" bitMenuItem (click)="bulkMoveToFolder()"> <button *ngIf="bulkMoveAllowed" type="button" bitMenuItem (click)="bulkMoveToFolder()">
<i class="bwi bwi-fw bwi-folder" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-folder" aria-hidden="true"></i>
{{ (vaultBulkManagementActionEnabled ? "addToFolder" : "moveSelected") | i18n }} {{ "addToFolder" | i18n }}
</button> </button>
<button <button
*ngIf="showAdminActions && showBulkEditCollectionAccess" *ngIf="showAdminActions && showBulkEditCollectionAccess"
@ -60,21 +60,12 @@
<i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-collection" aria-hidden="true"></i>
{{ "assignToCollections" | i18n }} {{ "assignToCollections" | i18n }}
</button> </button>
<button
*ngIf="bulkMoveAllowed && !vaultBulkManagementActionEnabled"
type="button"
bitMenuItem
(click)="bulkMoveToOrganization()"
>
<i class="bwi bwi-fw bwi-arrow-circle-right" aria-hidden="true"></i>
{{ "moveSelectedToOrg" | i18n }}
</button>
<button *ngIf="showBulkTrashOptions" type="button" bitMenuItem (click)="bulkRestore()"> <button *ngIf="showBulkTrashOptions" type="button" bitMenuItem (click)="bulkRestore()">
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
{{ "restoreSelected" | i18n }} {{ "restoreSelected" | i18n }}
</button> </button>
<button <button
*ngIf="deleteAllowed || showBulkTrashOptions" *ngIf="showDelete() || showBulkTrashOptions"
type="button" type="button"
bitMenuItem bitMenuItem
(click)="bulkDelete()" (click)="bulkDelete()"
@ -131,8 +122,7 @@
[organizations]="allOrganizations" [organizations]="allOrganizations"
[collections]="allCollections" [collections]="allCollections"
[checked]="selection.isSelected(item)" [checked]="selection.isSelected(item)"
[canEditCipher]="canEditCipher(item.cipher) && vaultBulkManagementActionEnabled" [canEditCipher]="canEditCipher(item.cipher)"
[vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled"
(checkedToggled)="selection.toggle(item)" (checkedToggled)="selection.toggle(item)"
(onEvent)="event($event)" (onEvent)="event($event)"
></tr> ></tr>

View File

@ -46,7 +46,6 @@ export class VaultItemsComponent {
@Input() viewingOrgVault: boolean; @Input() viewingOrgVault: boolean;
@Input() addAccessStatus: number; @Input() addAccessStatus: number;
@Input() addAccessToggle: boolean; @Input() addAccessToggle: boolean;
@Input() vaultBulkManagementActionEnabled = false;
private _ciphers?: CipherView[] = []; private _ciphers?: CipherView[] = [];
@Input() get ciphers(): CipherView[] { @Input() get ciphers(): CipherView[] {
@ -93,23 +92,13 @@ export class VaultItemsComponent {
} }
get disableMenu() { get disableMenu() {
return ( return !this.bulkMoveAllowed && !this.showAssignToCollections() && !this.showDelete();
this.vaultBulkManagementActionEnabled &&
!this.bulkMoveAllowed &&
!this.showAssignToCollections() &&
!this.showDelete()
);
} }
get bulkAssignToCollectionsAllowed() { get bulkAssignToCollectionsAllowed() {
return this.showBulkAddToCollections && this.ciphers.length > 0; return this.showBulkAddToCollections && this.ciphers.length > 0;
} }
// Use new bulk management delete if vaultBulkManagementActionEnabled feature flag is enabled
get deleteAllowed() {
return this.vaultBulkManagementActionEnabled ? this.showDelete() : true;
}
protected canEditCollection(collection: CollectionView): boolean { protected canEditCollection(collection: CollectionView): boolean {
// Only allow allow deletion if collection editing is enabled and not deleting "Unassigned" // Only allow allow deletion if collection editing is enabled and not deleting "Unassigned"
if (collection.id === Unassigned) { if (collection.id === Unassigned) {
@ -156,15 +145,6 @@ export class VaultItemsComponent {
}); });
} }
protected bulkMoveToOrganization() {
this.event({
type: "moveToOrganization",
items: this.selection.selected
.filter((item) => item.cipher !== undefined)
.map((item) => item.cipher),
});
}
protected bulkRestore() { protected bulkRestore() {
this.event({ this.event({
type: "restore", type: "restore",

View File

@ -1,7 +1,7 @@
<form [formGroup]="formGroup" [bitSubmit]="submit"> <form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small"> <bit-dialog dialogSize="small">
<span bitDialogTitle> <span bitDialogTitle>
{{ ((vaultBulkManagementActionEnabled$ | async) ? "addToFolder" : "moveSelected") | i18n }} {{ "addToFolder" | i18n }}
</span> </span>
<span bitDialogContent> <span bitDialogContent>
<p>{{ "moveSelectedItemsDesc" | i18n: cipherIds.length }}</p> <p>{{ "moveSelectedItemsDesc" | i18n: cipherIds.length }}</p>

View File

@ -3,8 +3,6 @@ import { Component, Inject, OnInit } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms"; import { FormBuilder, Validators } from "@angular/forms";
import { firstValueFrom, Observable } from "rxjs"; import { firstValueFrom, Observable } from "rxjs";
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 { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@ -47,10 +45,6 @@ export class BulkMoveDialogComponent implements OnInit {
}); });
folders$: Observable<FolderView[]>; folders$: Observable<FolderView[]>;
protected vaultBulkManagementActionEnabled$ = this.configService.getFeatureFlag$(
FeatureFlag.VaultBulkManagementAction,
);
constructor( constructor(
@Inject(DIALOG_DATA) params: BulkMoveDialogParams, @Inject(DIALOG_DATA) params: BulkMoveDialogParams,
private dialogRef: DialogRef<BulkMoveDialogResult>, private dialogRef: DialogRef<BulkMoveDialogResult>,
@ -59,7 +53,6 @@ export class BulkMoveDialogComponent implements OnInit {
private i18nService: I18nService, private i18nService: I18nService,
private folderService: FolderService, private folderService: FolderService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private configService: ConfigService,
) { ) {
this.cipherIds = params.cipherIds ?? []; this.cipherIds = params.cipherIds ?? [];
} }

View File

@ -54,9 +54,8 @@
[showBulkTrashOptions]="filter.type === 'trash'" [showBulkTrashOptions]="filter.type === 'trash'"
[useEvents]="false" [useEvents]="false"
[showAdminActions]="false" [showAdminActions]="false"
[showBulkAddToCollections]="vaultBulkManagementActionEnabled$ | async" [showBulkAddToCollections]="true"
(onEvent)="onVaultItemsEvent($event)" (onEvent)="onVaultItemsEvent($event)"
[vaultBulkManagementActionEnabled]="vaultBulkManagementActionEnabled$ | async"
> >
</app-vault-items> </app-vault-items>
<div <div

View File

@ -100,16 +100,7 @@ import {
BulkMoveDialogResult, BulkMoveDialogResult,
openBulkMoveDialog, openBulkMoveDialog,
} from "./bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component"; } from "./bulk-action-dialogs/bulk-move-dialog/bulk-move-dialog.component";
import {
BulkShareDialogResult,
openBulkShareDialog,
} from "./bulk-action-dialogs/bulk-share-dialog/bulk-share-dialog.component";
import {
CollectionsDialogResult,
openIndividualVaultCollectionsDialog,
} from "./collections.component";
import { FolderAddEditDialogResult, openFolderAddEditDialog } from "./folder-add-edit.component"; import { FolderAddEditDialogResult, openFolderAddEditDialog } from "./folder-add-edit.component";
import { ShareComponent } from "./share.component";
import { VaultBannersComponent } from "./vault-banners/vault-banners.component"; import { VaultBannersComponent } from "./vault-banners/vault-banners.component";
import { VaultFilterComponent } from "./vault-filter/components/vault-filter.component"; import { VaultFilterComponent } from "./vault-filter/components/vault-filter.component";
import { VaultFilterService } from "./vault-filter/services/abstractions/vault-filter.service"; import { VaultFilterService } from "./vault-filter/services/abstractions/vault-filter.service";
@ -183,9 +174,6 @@ export class VaultComponent implements OnInit, OnDestroy {
protected selectedCollection: TreeNode<CollectionView> | undefined; protected selectedCollection: TreeNode<CollectionView> | undefined;
protected canCreateCollections = false; protected canCreateCollections = false;
protected currentSearchText$: Observable<string>; protected currentSearchText$: Observable<string>;
protected vaultBulkManagementActionEnabled$ = this.configService.getFeatureFlag$(
FeatureFlag.VaultBulkManagementAction,
);
private searchText$ = new Subject<string>(); private searchText$ = new Subject<string>();
private refresh$ = new BehaviorSubject<void>(null); private refresh$ = new BehaviorSubject<void>(null);
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
@ -458,9 +446,6 @@ export class VaultComponent implements OnInit, OnDestroy {
case "viewAttachments": case "viewAttachments":
await this.editCipherAttachments(event.item); await this.editCipherAttachments(event.item);
break; break;
case "viewCipherCollections":
await this.editCipherCollections(event.item);
break;
case "clone": case "clone":
await this.cloneCipher(event.item); await this.cloneCipher(event.item);
break; break;
@ -477,13 +462,6 @@ export class VaultComponent implements OnInit, OnDestroy {
case "moveToFolder": case "moveToFolder":
await this.bulkMove(event.items); await this.bulkMove(event.items);
break; break;
case "moveToOrganization":
if (event.items.length === 1) {
await this.shareCipher(event.items[0]);
} else {
await this.bulkShare(event.items);
}
break;
case "copyField": case "copyField":
await this.copy(event.item, event.field); await this.copy(event.item, event.field);
break; break;
@ -566,9 +544,6 @@ export class VaultComponent implements OnInit, OnDestroy {
} }
const canEditAttachments = await this.canEditAttachments(cipher); const canEditAttachments = await this.canEditAttachments(cipher);
const vaultBulkManagementActionEnabled = await firstValueFrom(
this.vaultBulkManagementActionEnabled$,
);
let madeAttachmentChanges = false; let madeAttachmentChanges = false;
@ -594,7 +569,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.attachmentsModalRef, this.attachmentsModalRef,
(comp) => { (comp) => {
comp.cipherId = cipher.id; comp.cipherId = cipher.id;
comp.viewOnly = !canEditAttachments && vaultBulkManagementActionEnabled; comp.viewOnly = !canEditAttachments;
comp.onUploadedAttachment comp.onUploadedAttachment
.pipe(takeUntil(this.destroy$)) .pipe(takeUntil(this.destroy$))
.subscribe(() => (madeAttachmentChanges = true)); .subscribe(() => (madeAttachmentChanges = true));
@ -615,41 +590,6 @@ export class VaultComponent implements OnInit, OnDestroy {
}); });
} }
async shareCipher(cipher: CipherView) {
if (cipher.organizationId != null) {
// You cannot move ciphers between organizations
this.showMissingPermissionsError();
return;
}
if (cipher?.reprompt !== 0 && !(await this.passwordRepromptService.showPasswordPrompt())) {
this.go({ cipherId: null, itemId: null });
return;
}
const [modal] = await this.modalService.openViewRef(
ShareComponent,
this.shareModalRef,
(comp) => {
comp.cipherId = cipher.id;
comp.onSharedCipher.pipe(takeUntil(this.destroy$)).subscribe(() => {
modal.close();
this.refresh();
});
},
);
}
async editCipherCollections(cipher: CipherView) {
const dialog = openIndividualVaultCollectionsDialog(this.dialogService, {
data: { cipherId: cipher.id },
});
const result = await lastValueFrom(dialog.closed);
if (result === CollectionsDialogResult.Saved) {
this.refresh();
}
}
async addCipher(cipherType?: CipherType) { async addCipher(cipherType?: CipherType) {
if (this.extensionRefreshEnabled) { if (this.extensionRefreshEnabled) {
return this.addCipherV2(cipherType); return this.addCipherV2(cipherType);
@ -1255,34 +1195,6 @@ export class VaultComponent implements OnInit, OnDestroy {
} }
} }
async bulkShare(ciphers: CipherView[]) {
if (!(await this.repromptCipher(ciphers))) {
return;
}
if (ciphers.some((c) => c.organizationId != null)) {
// You cannot move ciphers between organizations
this.showMissingPermissionsError();
return;
}
if (ciphers.length === 0) {
this.toastService.showToast({
variant: "error",
title: null,
message: this.i18nService.t("nothingSelected"),
});
return;
}
const dialog = openBulkShareDialog(this.dialogService, { data: { ciphers } });
const result = await lastValueFrom(dialog.closed);
if (result === BulkShareDialogResult.Shared) {
this.refresh();
}
}
protected deleteCipherWithServer(id: string, permanent: boolean) { protected deleteCipherWithServer(id: string, permanent: boolean) {
return permanent return permanent
? this.cipherService.deleteWithServer(id) ? this.cipherService.deleteWithServer(id)

View File

@ -598,9 +598,6 @@ export class VaultComponent implements OnInit, OnDestroy {
case "viewAttachments": case "viewAttachments":
await this.editCipherAttachments(event.item); await this.editCipherAttachments(event.item);
break; break;
case "viewCipherCollections":
await this.editCipherCollections(event.item);
break;
case "clone": case "clone":
await this.cloneCipher(event.item); await this.cloneCipher(event.item);
break; break;

View File

@ -20,7 +20,6 @@ export enum FeatureFlag {
EnableTimeThreshold = "PM-5864-dollar-threshold", EnableTimeThreshold = "PM-5864-dollar-threshold",
InlineMenuPositioningImprovements = "inline-menu-positioning-improvements", InlineMenuPositioningImprovements = "inline-menu-positioning-improvements",
ProviderClientVaultPrivacyBanner = "ac-2833-provider-client-vault-privacy-banner", ProviderClientVaultPrivacyBanner = "ac-2833-provider-client-vault-privacy-banner",
VaultBulkManagementAction = "vault-bulk-management-action",
AC2828_ProviderPortalMembersPage = "AC-2828_provider-portal-members-page", AC2828_ProviderPortalMembersPage = "AC-2828_provider-portal-members-page",
IdpAutoSubmitLogin = "idp-auto-submit-login", IdpAutoSubmitLogin = "idp-auto-submit-login",
UnauthenticatedExtensionUIRefresh = "unauth-ui-refresh", UnauthenticatedExtensionUIRefresh = "unauth-ui-refresh",
@ -64,7 +63,6 @@ export const DefaultFeatureFlagValue = {
[FeatureFlag.EnableTimeThreshold]: FALSE, [FeatureFlag.EnableTimeThreshold]: FALSE,
[FeatureFlag.InlineMenuPositioningImprovements]: FALSE, [FeatureFlag.InlineMenuPositioningImprovements]: FALSE,
[FeatureFlag.ProviderClientVaultPrivacyBanner]: FALSE, [FeatureFlag.ProviderClientVaultPrivacyBanner]: FALSE,
[FeatureFlag.VaultBulkManagementAction]: FALSE,
[FeatureFlag.AC2828_ProviderPortalMembersPage]: FALSE, [FeatureFlag.AC2828_ProviderPortalMembersPage]: FALSE,
[FeatureFlag.IdpAutoSubmitLogin]: FALSE, [FeatureFlag.IdpAutoSubmitLogin]: FALSE,
[FeatureFlag.UnauthenticatedExtensionUIRefresh]: FALSE, [FeatureFlag.UnauthenticatedExtensionUIRefresh]: FALSE,