1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-07-02 11:34:53 +02:00

PM-3632 - Vault Timeout Input comp (all clients) - resolve bug where logic which was supposed to initialize the custom vault timeout timeframe if coming from a previously selected numeric timeout was not working properly. (#6102)

This commit is contained in:
Jared Snider 2023-08-29 17:08:02 -04:00 committed by GitHub
parent c8c314dd35
commit 3930189c4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,14 +76,17 @@ export class VaultTimeoutInputComponent
}
});
// Assign the previous value to the custom fields
// Assign the current value to the custom fields
// so that if the user goes from a numeric value to custom
// we can initialize the custom fields with the current value
// ex: user picks 5 min, goes to custom, we want to show 0 hr, 5 min in the custom fields
this.form.controls.vaultTimeout.valueChanges
.pipe(
filter((value) => value !== VaultTimeoutInputComponent.CUSTOM_VALUE),
takeUntil(this.destroy$)
)
.subscribe((_) => {
const current = Math.max(this.form.value.vaultTimeout, 0);
.subscribe((value) => {
const current = Math.max(value, 0);
this.form.patchValue({
custom: {
hours: Math.floor(current / 60),