1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

[PM-17656] Update the org vault filter whenever policies update (#13280)

This commit is contained in:
Shane Melton
2025-02-19 16:14:43 -08:00
committed by GitHub
parent 33e1a6e917
commit 1bcfcc7dec

View File

@@ -2,7 +2,7 @@
// @ts-strict-ignore
import { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output } from "@angular/core";
import { Router } from "@angular/router";
import { firstValueFrom, Subject } from "rxjs";
import { firstValueFrom, merge, Subject, switchMap, takeUntil } from "rxjs";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
@@ -109,6 +109,19 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
this.activeFilter.selectedCipherTypeNode =
(await this.getDefaultFilter()) as TreeNode<CipherTypeFilter>;
this.isLoaded = true;
// Without refactoring the entire component, we need to manually update the organization filter whenever the policies update
merge(
this.policyService.get$(PolicyType.SingleOrg),
this.policyService.get$(PolicyType.PersonalOwnership),
)
.pipe(
switchMap(() => this.addOrganizationFilter()),
takeUntil(this.destroy$),
)
.subscribe((orgFilters) => {
this.filters.organizationFilter = orgFilters;
});
}
ngOnDestroy() {