1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

chore(flag-removal): [Auth/PM20439] Remove flagging logic and flag (BrowserExtensionLoginApproval) (#16568)

This commit is contained in:
rr-bw
2025-09-29 13:29:56 -07:00
committed by GitHub
parent 0bfc5daa7c
commit 5f7e1f99bf
11 changed files with 64 additions and 127 deletions

View File

@@ -1,6 +1,5 @@
import { TestBed } from "@angular/core/testing";
import { mock, MockProxy } from "jest-mock-extended";
import { BehaviorSubject, firstValueFrom, of, take, timeout } from "rxjs";
import { BehaviorSubject, firstValueFrom, take, timeout } from "rxjs";
import {
AuthRequestServiceAbstraction,
@@ -13,7 +12,6 @@ import { DeviceView } from "@bitwarden/common/auth/abstractions/devices/views/de
import { AuthRequestResponse } from "@bitwarden/common/auth/models/response/auth-request.response";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { DeviceType } from "@bitwarden/common/enums";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { StateProvider } from "@bitwarden/common/platform/state";
@@ -45,14 +43,11 @@ describe("VaultBannersService", () => {
});
const devices$ = new BehaviorSubject<DeviceView[]>([]);
const pendingAuthRequests$ = new BehaviorSubject<Array<AuthRequestResponse>>([]);
let configService: MockProxy<ConfigService>;
beforeEach(() => {
lastSync$.next(new Date("2024-05-14"));
isSelfHost.mockClear();
getEmailVerified.mockClear().mockResolvedValue(true);
configService = mock<ConfigService>();
configService.getFeatureFlag$.mockImplementation(() => of(true));
TestBed.configureTestingModule({
providers: [
@@ -99,10 +94,6 @@ describe("VaultBannersService", () => {
provide: AuthRequestServiceAbstraction,
useValue: { getPendingAuthRequests$: () => pendingAuthRequests$ },
},
{
provide: ConfigService,
useValue: configService,
},
],
});
});

View File

@@ -6,10 +6,7 @@ import {
UserDecryptionOptionsServiceAbstraction,
} from "@bitwarden/auth/common";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { DevicesServiceAbstraction } from "@bitwarden/common/auth/abstractions/devices/devices.service.abstraction";
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import {
StateProvider,
@@ -70,9 +67,7 @@ export class VaultBannersService {
private kdfConfigService: KdfConfigService,
private syncService: SyncService,
private userDecryptionOptionsService: UserDecryptionOptionsServiceAbstraction,
private devicesService: DevicesServiceAbstraction,
private authRequestService: AuthRequestServiceAbstraction,
private configService: ConfigService,
) {}
/** Returns true when the pending auth request banner should be shown */
@@ -80,24 +75,12 @@ export class VaultBannersService {
const alreadyDismissed = (await this.getBannerDismissedState(userId)).includes(
VisibleVaultBanner.PendingAuthRequest,
);
// TODO: PM-20439 remove feature flag
const browserLoginApprovalFeatureFlag = await firstValueFrom(
this.configService.getFeatureFlag$(FeatureFlag.PM14938_BrowserExtensionLoginApproval),
const pendingAuthRequests = await firstValueFrom(
this.authRequestService.getPendingAuthRequests$(),
);
if (browserLoginApprovalFeatureFlag === true) {
const pendingAuthRequests = await firstValueFrom(
this.authRequestService.getPendingAuthRequests$(),
);
return pendingAuthRequests.length > 0 && !alreadyDismissed;
} else {
const devices = await firstValueFrom(this.devicesService.getDevices$());
const hasPendingRequest = devices.some(
(device) => device.response?.devicePendingAuthRequest != null,
);
return hasPendingRequest && !alreadyDismissed;
}
return pendingAuthRequests.length > 0 && !alreadyDismissed;
}
shouldShowPremiumBanner$(userId: UserId): Observable<boolean> {