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>
</ng-container>
<button
bitMenuItem
*ngIf="showAttachments || !vaultBulkManagementActionEnabled"
type="button"
(click)="attachments()"
>
<button bitMenuItem *ngIf="showAttachments" type="button" (click)="attachments()">
<i class="bwi bwi-fw bwi-paperclip" aria-hidden="true"></i>
{{ "attachments" | i18n }}
</button>
@ -119,26 +114,6 @@
<i class="bwi bwi-fw bwi-files" aria-hidden="true"></i>
{{ "clone" | i18n }}
</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
bitMenuItem
*ngIf="showAssignToCollections"
@ -156,12 +131,7 @@
<i class="bwi bwi-fw bwi-undo" aria-hidden="true"></i>
{{ "restore" | i18n }}
</button>
<button
bitMenuItem
*ngIf="canEditCipher || !vaultBulkManagementActionEnabled"
(click)="deleteCipher()"
type="button"
>
<button bitMenuItem *ngIf="canEditCipher" (click)="deleteCipher()" type="button">
<span class="tw-text-danger">
<i class="bwi bwi-fw bwi-trash" aria-hidden="true"></i>
{{ (cipher.isDeleted ? "permanentlyDelete" : "delete") | i18n }}

View File

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

View File

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

View File

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

View File

@ -46,7 +46,6 @@ export class VaultItemsComponent {
@Input() viewingOrgVault: boolean;
@Input() addAccessStatus: number;
@Input() addAccessToggle: boolean;
@Input() vaultBulkManagementActionEnabled = false;
private _ciphers?: CipherView[] = [];
@Input() get ciphers(): CipherView[] {
@ -93,23 +92,13 @@ export class VaultItemsComponent {
}
get disableMenu() {
return (
this.vaultBulkManagementActionEnabled &&
!this.bulkMoveAllowed &&
!this.showAssignToCollections() &&
!this.showDelete()
);
return !this.bulkMoveAllowed && !this.showAssignToCollections() && !this.showDelete();
}
get bulkAssignToCollectionsAllowed() {
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 {
// Only allow allow deletion if collection editing is enabled and not deleting "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() {
this.event({
type: "restore",

View File

@ -1,7 +1,7 @@
<form [formGroup]="formGroup" [bitSubmit]="submit">
<bit-dialog dialogSize="small">
<span bitDialogTitle>
{{ ((vaultBulkManagementActionEnabled$ | async) ? "addToFolder" : "moveSelected") | i18n }}
{{ "addToFolder" | i18n }}
</span>
<span bitDialogContent>
<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 { 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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@ -47,10 +45,6 @@ export class BulkMoveDialogComponent implements OnInit {
});
folders$: Observable<FolderView[]>;
protected vaultBulkManagementActionEnabled$ = this.configService.getFeatureFlag$(
FeatureFlag.VaultBulkManagementAction,
);
constructor(
@Inject(DIALOG_DATA) params: BulkMoveDialogParams,
private dialogRef: DialogRef<BulkMoveDialogResult>,
@ -59,7 +53,6 @@ export class BulkMoveDialogComponent implements OnInit {
private i18nService: I18nService,
private folderService: FolderService,
private formBuilder: FormBuilder,
private configService: ConfigService,
) {
this.cipherIds = params.cipherIds ?? [];
}

View File

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

View File

@ -100,16 +100,7 @@ import {
BulkMoveDialogResult,
openBulkMoveDialog,
} 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 { ShareComponent } from "./share.component";
import { VaultBannersComponent } from "./vault-banners/vault-banners.component";
import { VaultFilterComponent } from "./vault-filter/components/vault-filter.component";
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 canCreateCollections = false;
protected currentSearchText$: Observable<string>;
protected vaultBulkManagementActionEnabled$ = this.configService.getFeatureFlag$(
FeatureFlag.VaultBulkManagementAction,
);
private searchText$ = new Subject<string>();
private refresh$ = new BehaviorSubject<void>(null);
private destroy$ = new Subject<void>();
@ -458,9 +446,6 @@ export class VaultComponent implements OnInit, OnDestroy {
case "viewAttachments":
await this.editCipherAttachments(event.item);
break;
case "viewCipherCollections":
await this.editCipherCollections(event.item);
break;
case "clone":
await this.cloneCipher(event.item);
break;
@ -477,13 +462,6 @@ export class VaultComponent implements OnInit, OnDestroy {
case "moveToFolder":
await this.bulkMove(event.items);
break;
case "moveToOrganization":
if (event.items.length === 1) {
await this.shareCipher(event.items[0]);
} else {
await this.bulkShare(event.items);
}
break;
case "copyField":
await this.copy(event.item, event.field);
break;
@ -566,9 +544,6 @@ export class VaultComponent implements OnInit, OnDestroy {
}
const canEditAttachments = await this.canEditAttachments(cipher);
const vaultBulkManagementActionEnabled = await firstValueFrom(
this.vaultBulkManagementActionEnabled$,
);
let madeAttachmentChanges = false;
@ -594,7 +569,7 @@ export class VaultComponent implements OnInit, OnDestroy {
this.attachmentsModalRef,
(comp) => {
comp.cipherId = cipher.id;
comp.viewOnly = !canEditAttachments && vaultBulkManagementActionEnabled;
comp.viewOnly = !canEditAttachments;
comp.onUploadedAttachment
.pipe(takeUntil(this.destroy$))
.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) {
if (this.extensionRefreshEnabled) {
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) {
return permanent
? this.cipherService.deleteWithServer(id)

View File

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

View File

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