From 9b13ff547ea881445e6450db07044f1da5044bc5 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Wed, 14 May 2025 04:20:24 -0700 Subject: [PATCH] [Account Recovery][PM-18721] convert retreival of policy options to be observable first --- .../account-recovery-dialog.component.html | 2 +- .../account-recovery-dialog.component.ts | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.html b/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.html index 854ff814262..bebe6eb1c87 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.html @@ -7,7 +7,7 @@ diff --git a/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.ts b/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.ts index 6f3d02c06fa..c4015e3bc63 100644 --- a/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.ts +++ b/apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.ts @@ -1,6 +1,6 @@ import { CommonModule } from "@angular/common"; -import { Component, Inject, OnInit, ViewChild } from "@angular/core"; -import { firstValueFrom } from "rxjs"; +import { Component, Inject, ViewChild } from "@angular/core"; +import { switchMap } from "rxjs"; import { InputPasswordComponent, @@ -79,7 +79,7 @@ type AccountRecoveryDialogResultType = InputPasswordComponent, ], }) -export class AccountRecoveryDialogComponent implements OnInit { +export class AccountRecoveryDialogComponent { @ViewChild(InputPasswordComponent) inputPasswordComponent!: InputPasswordComponent; @@ -88,6 +88,11 @@ export class AccountRecoveryDialogComponent implements OnInit { receivedPasswordInputResult = false; submitting = false; + masterPasswordPolicyOptions$ = this.accountService.activeAccount$.pipe( + getUserId, + switchMap((userId) => this.policyService.masterPasswordPolicyOptions$(userId)), + ); + get loggedOutWarningName() { return this.dialogData.name != null ? this.dialogData.name : this.i18nService.t("thisUser"); } @@ -103,14 +108,6 @@ export class AccountRecoveryDialogComponent implements OnInit { private toastService: ToastService, ) {} - async ngOnInit() { - const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); - - this.masterPasswordPolicyOptions = await firstValueFrom( - this.policyService.masterPasswordPolicyOptions$(userId), - ); - } - handlePrimaryButtonClick = async () => { try { this.submitting = true;