mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 01:33:33 +00:00
[PM-23306] "Show cards in autofill" is defaulting to on when the setting is enabled (#15534)
* disable card autofill * Fixed dependency issues
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { map, Observable, switchMap } from "rxjs";
|
||||
import { combineLatest, map, Observable, startWith, switchMap } from "rxjs";
|
||||
|
||||
import { CipherType } from "@bitwarden/common/vault/enums";
|
||||
import { RestrictedItemTypesService } from "@bitwarden/common/vault/services/restricted-item-types.service";
|
||||
|
||||
import { PolicyService } from "../../admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { PolicyType } from "../../admin-console/enums";
|
||||
@@ -155,6 +158,7 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
private stateProvider: StateProvider,
|
||||
private policyService: PolicyService,
|
||||
private accountService: AccountService,
|
||||
private restrictedItemTypesService: RestrictedItemTypesService,
|
||||
) {
|
||||
this.autofillOnPageLoadState = this.stateProvider.getActive(AUTOFILL_ON_PAGE_LOAD);
|
||||
this.autofillOnPageLoad$ = this.autofillOnPageLoadState.state$.pipe(map((x) => x ?? false));
|
||||
@@ -199,7 +203,16 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
|
||||
);
|
||||
|
||||
this.showInlineMenuCardsState = this.stateProvider.getActive(SHOW_INLINE_MENU_CARDS);
|
||||
this.showInlineMenuCards$ = this.showInlineMenuCardsState.state$.pipe(map((x) => x ?? true));
|
||||
this.showInlineMenuCards$ = combineLatest([
|
||||
this.showInlineMenuCardsState.state$.pipe(map((x) => x ?? true)),
|
||||
this.restrictedItemTypesService.restricted$.pipe(startWith([])),
|
||||
]).pipe(
|
||||
map(
|
||||
([enabled, restrictions]) =>
|
||||
// If enabled, show cards inline menu unless card type is restricted
|
||||
enabled && !restrictions.some((r) => r.cipherType === CipherType.Card),
|
||||
),
|
||||
);
|
||||
|
||||
this.enableContextMenuState = this.stateProvider.getGlobal(ENABLE_CONTEXT_MENU);
|
||||
this.enableContextMenu$ = this.enableContextMenuState.state$.pipe(map((x) => x ?? true));
|
||||
|
||||
Reference in New Issue
Block a user