1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-19656] Fix zip option not being set correctly after navigating to Admin Console (#14058)

* Simplify if to reduce nesting

* Start subscribing to changes of the vaultSelector as soon as possible during ngOnInit

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith
2025-03-31 15:55:20 +02:00
committed by GitHub
parent 51bfbcf090
commit 49924512b8

View File

@@ -225,6 +225,20 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
),
);
combineLatest([
this.exportForm.controls.vaultSelector.valueChanges,
this.isExportAttachmentsEnabled$,
])
.pipe(takeUntil(this.destroy$))
.subscribe(([value, isExportAttachmentsEnabled]) => {
this.organizationId = value !== "myVault" ? value : undefined;
this.formatOptions = this.formatOptions.filter((option) => option.value !== "zip");
if (value === "myVault" && isExportAttachmentsEnabled) {
this.formatOptions.push({ name: ".zip (with attachments)", value: "zip" });
}
});
merge(
this.exportForm.get("format").valueChanges,
this.exportForm.get("fileEncryptionType").valueChanges,
@@ -322,22 +336,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
takeUntil(this.destroy$),
)
.subscribe();
combineLatest([
this.exportForm.controls.vaultSelector.valueChanges,
this.isExportAttachmentsEnabled$,
])
.pipe(takeUntil(this.destroy$))
.subscribe(([value, isExportAttachmentsEnabled]) => {
this.organizationId = value !== "myVault" ? value : undefined;
if (value === "myVault" && isExportAttachmentsEnabled) {
if (!this.formatOptions.some((option) => option.value === "zip")) {
this.formatOptions.push({ name: ".zip (with attachments)", value: "zip" });
}
} else {
this.formatOptions = this.formatOptions.filter((option) => option.value !== "zip");
}
});
}
ngAfterViewInit(): void {