mirror of
https://github.com/bitwarden/clients.git
synced 2026-06-13 21:01:11 +08:00
[PM-27679] Remove flagged logic from clients and clients feature flag (#20609)
This commit is contained in:
parent
eec6bc1a31
commit
568faee0ea
@ -80,7 +80,6 @@ export enum FeatureFlag {
|
||||
PM28190CipherSharingOpsToSdk = "pm-28190-cipher-sharing-ops-to-sdk",
|
||||
PM22134SdkCipherListView = "pm-22134-sdk-cipher-list-view",
|
||||
CipherKeyEncryption = "cipher-key-encryption",
|
||||
MigrateMyVaultToMyItems = "pm-20558-migrate-myvault-to-myitems",
|
||||
PM27632_SdkCipherCrudOperations = "pm-27632-cipher-crud-operations-to-sdk",
|
||||
PM28191CipherAdminOpsToSdk = "pm-28191-cipher-admin-ops-to-sdk",
|
||||
PM28192_CipherAttachmentOpsToSdk = "pm-28192-cipher-attachment-ops-to-sdk",
|
||||
@ -164,7 +163,6 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.PM28191CipherAdminOpsToSdk]: FALSE,
|
||||
[FeatureFlag.PM28190CipherSharingOpsToSdk]: FALSE,
|
||||
[FeatureFlag.PM28192_CipherAttachmentOpsToSdk]: FALSE,
|
||||
[FeatureFlag.MigrateMyVaultToMyItems]: FALSE,
|
||||
[FeatureFlag.PM30521_AutofillButtonViewLoginScreen]: FALSE,
|
||||
[FeatureFlag.PM29438_DialogWithExtensionPromptAccountAge]: 5,
|
||||
[FeatureFlag.PM32180PremiumUpsellAccountAge]: 7,
|
||||
|
||||
@ -10,8 +10,6 @@ import { CollectionView } from "@bitwarden/common/admin-console/models/collectio
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
|
||||
import { EventCollectionService, EventType } from "@bitwarden/common/dirt/event-logs";
|
||||
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 { OrganizationId, CollectionId } from "@bitwarden/common/types/guid";
|
||||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
|
||||
@ -41,7 +39,6 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
let mockDialogService: MockProxy<DialogService>;
|
||||
let mockToastService: MockProxy<ToastService>;
|
||||
let mockEventCollectionService: MockProxy<EventCollectionService>;
|
||||
let mockConfigService: MockProxy<ConfigService>;
|
||||
let mockOrganizationUserApiService: MockProxy<OrganizationUserApiService>;
|
||||
let mockSyncService: MockProxy<SyncService>;
|
||||
|
||||
@ -78,7 +75,6 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
mockDialogService = mock<DialogService>();
|
||||
mockToastService = mock<ToastService>();
|
||||
mockEventCollectionService = mock<EventCollectionService>();
|
||||
mockConfigService = mock<ConfigService>();
|
||||
mockOrganizationUserApiService = mock<OrganizationUserApiService>();
|
||||
mockSyncService = mock<SyncService>();
|
||||
|
||||
@ -95,7 +91,6 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
mockDialogService,
|
||||
mockToastService,
|
||||
mockEventCollectionService,
|
||||
mockConfigService,
|
||||
mockOrganizationUserApiService,
|
||||
mockSyncService,
|
||||
);
|
||||
@ -653,13 +648,11 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
} as Organization;
|
||||
|
||||
function setupMocksForEnforcementScenario(options: {
|
||||
featureEnabled?: boolean;
|
||||
policies?: Policy[];
|
||||
organizations?: Organization[];
|
||||
ciphers?: CipherView[];
|
||||
defaultCollection?: CollectionView;
|
||||
}): void {
|
||||
mockConfigService.getFeatureFlag.mockResolvedValue(options.featureEnabled ?? true);
|
||||
mockPolicyService.policiesByType$.mockReturnValue(of(options.policies ?? []));
|
||||
mockOrganizationService.organizations$.mockReturnValue(of(options.organizations ?? []));
|
||||
mockCipherService.cipherViews$.mockReturnValue(of(options.ciphers ?? []));
|
||||
@ -668,28 +661,6 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
mockOrganizationUserApiService.revokeSelf.mockResolvedValue(undefined);
|
||||
}
|
||||
|
||||
it("does nothing when feature flag is disabled", async () => {
|
||||
setupMocksForEnforcementScenario({
|
||||
featureEnabled: false,
|
||||
policies: [policy],
|
||||
organizations: [organization],
|
||||
ciphers: [{ id: "cipher-1" } as CipherView],
|
||||
defaultCollection: {
|
||||
id: collectionId,
|
||||
organizationId: organizationId,
|
||||
isDefaultCollection: true,
|
||||
} as CollectionView,
|
||||
});
|
||||
|
||||
await service.enforceOrganizationDataOwnership(userId);
|
||||
|
||||
expect(mockConfigService.getFeatureFlag).toHaveBeenCalledWith(
|
||||
FeatureFlag.MigrateMyVaultToMyItems,
|
||||
);
|
||||
expect(mockDialogService.open).not.toHaveBeenCalled();
|
||||
expect(mockCipherService.shareManyWithServer).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does nothing when no migration is required", async () => {
|
||||
setupMocksForEnforcementScenario({ policies: [] });
|
||||
|
||||
@ -965,13 +936,11 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
} as Organization;
|
||||
|
||||
function setupMocksForTransferScenario(options: {
|
||||
featureEnabled?: boolean;
|
||||
policies?: Policy[];
|
||||
organizations?: Organization[];
|
||||
ciphers?: CipherView[];
|
||||
defaultCollection?: CollectionView;
|
||||
}): void {
|
||||
mockConfigService.getFeatureFlag.mockResolvedValue(options.featureEnabled ?? true);
|
||||
mockPolicyService.policiesByType$.mockReturnValue(of(options.policies ?? []));
|
||||
mockOrganizationService.organizations$.mockReturnValue(of(options.organizations ?? []));
|
||||
mockCipherService.cipherViews$.mockReturnValue(of(options.ciphers ?? []));
|
||||
@ -1058,7 +1027,6 @@ describe("DefaultVaultItemsTransferService", () => {
|
||||
} as CollectionView;
|
||||
|
||||
beforeEach(() => {
|
||||
mockConfigService.getFeatureFlag.mockResolvedValue(true);
|
||||
mockPolicyService.policiesByType$.mockReturnValue(of([policy]));
|
||||
mockOrganizationService.organizations$.mockReturnValue(of([organization]));
|
||||
mockCipherService.cipherViews$.mockReturnValue(of(personalCiphers));
|
||||
|
||||
@ -16,8 +16,6 @@ import { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
|
||||
import { OrganizationUserStatusType, PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { EventCollectionService, EventType } from "@bitwarden/common/dirt/event-logs";
|
||||
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 { getById } from "@bitwarden/common/platform/misc";
|
||||
import { OrganizationId, CollectionId } from "@bitwarden/common/types/guid";
|
||||
@ -52,7 +50,6 @@ export class DefaultVaultItemsTransferService implements VaultItemsTransferServi
|
||||
private dialogService: DialogService,
|
||||
private toastService: ToastService,
|
||||
private eventCollectionService: EventCollectionService,
|
||||
private configService: ConfigService,
|
||||
private organizationUserApiService: OrganizationUserApiService,
|
||||
private syncService: SyncService,
|
||||
) {}
|
||||
@ -148,11 +145,7 @@ export class DefaultVaultItemsTransferService implements VaultItemsTransferServi
|
||||
}
|
||||
|
||||
async enforceOrganizationDataOwnership(userId: UserId): Promise<void> {
|
||||
const featureEnabled = await this.configService.getFeatureFlag(
|
||||
FeatureFlag.MigrateMyVaultToMyItems,
|
||||
);
|
||||
|
||||
if (!featureEnabled || this.enforcementInFlight) {
|
||||
if (this.enforcementInFlight) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user