1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-22 07:50:04 +02:00

fix username preference flapping

This commit is contained in:
✨ Audrey ✨ 2024-10-17 13:46:25 -04:00
parent b9d17cbd14
commit 98270c9124
No known key found for this signature in database
GPG Key ID: 0CF8B4C0D9088B97
2 changed files with 11 additions and 11 deletions

View File

@ -60,7 +60,7 @@
<form class="box" [formGroup]="forwarder" class="tw-container">
<bit-form-field>
<bit-label>{{ "forwarder" | i18n }}</bit-label>
<bit-select [items]="forwarderOptions$ | async" formControlName="forwarder"> </bit-select>
<bit-select [items]="forwarderOptions$ | async" formControlName="nav"> </bit-select>
</bit-form-field>
</form>
<tools-catchall-settings

View File

@ -186,25 +186,25 @@ export class CredentialGeneratorComponent implements OnInit, OnDestroy {
this.root$
.pipe(
filter(({ nav }) => !!nav),
switchMap((root) => {
if (root.nav === IDENTIFIER) {
switchMap((maybeAlgorithm) => {
if (maybeAlgorithm.nav === IDENTIFIER) {
return concat(of(this.username.value), this.username.valueChanges);
} else {
return of(root as { nav: CredentialAlgorithm });
return of(maybeAlgorithm as { nav: CredentialAlgorithm });
}
}),
switchMap((username) => {
if (username.nav === FORWARDER) {
switchMap((maybeAlgorithm) => {
if (maybeAlgorithm.nav === FORWARDER) {
return concat(of(this.forwarder.value), this.forwarder.valueChanges);
} else {
return of(username as { nav: CredentialAlgorithm });
return of(maybeAlgorithm as { nav: CredentialAlgorithm });
}
}),
map((forwarder) => {
if (forwarder.nav === NONE_SELECTED) {
map((maybeAlgorithm) => {
if (maybeAlgorithm.nav === NONE_SELECTED) {
return { nav: null };
} else {
return forwarder as { nav: CredentialAlgorithm };
return maybeAlgorithm as { nav: CredentialAlgorithm };
}
}),
filter(({ nav }) => !!nav),
@ -237,7 +237,7 @@ export class CredentialGeneratorComponent implements OnInit, OnDestroy {
// the last preference set by the user "wins"
const forwarderPref = isForwarderIntegration(email.algorithm) ? email : null;
const usernamePref = email.updated > username.updated ? email : username;
const rootPref = username.updated > password.updated ? username : password;
const rootPref = usernamePref.updated > password.updated ? usernamePref : password;
// inject drilldown flags
const forwarderNav = !forwarderPref