Clear vault filter on account switch (#7227)

This commit is contained in:
Matt Gibson 2023-12-15 07:55:11 -05:00 committed by GitHub
parent c95e0f3d9b
commit 4644392d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -496,6 +496,7 @@ export default class MainBackground {
this.cipherService,
this.collectionService,
this.policyService,
this.accountService,
);
this.vaultTimeoutService = new VaultTimeoutService(

View File

@ -431,6 +431,7 @@ function getBgService<T>(service: keyof MainBackground) {
organizationService: OrganizationService,
folderService: FolderService,
policyService: PolicyService,
accountService: AccountServiceAbstraction,
) => {
return new VaultFilterService(
stateService,
@ -439,9 +440,16 @@ function getBgService<T>(service: keyof MainBackground) {
getBgService<CipherService>("cipherService")(),
getBgService<CollectionService>("collectionService")(),
policyService,
accountService,
);
},
deps: [StateServiceAbstraction, OrganizationService, FolderService, PolicyService],
deps: [
StateServiceAbstraction,
OrganizationService,
FolderService,
PolicyService,
AccountServiceAbstraction,
],
},
{
provide: ProviderService,

View File

@ -2,6 +2,7 @@ import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-
import { VaultFilterService as BaseVaultFilterService } from "@bitwarden/angular/vault/vault-filter/services/vault-filter.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
@ -21,6 +22,7 @@ export class VaultFilterService extends BaseVaultFilterService {
cipherService: CipherService,
collectionService: CollectionService,
policyService: PolicyService,
private accountService: AccountService,
) {
super(
stateService,
@ -32,6 +34,10 @@ export class VaultFilterService extends BaseVaultFilterService {
);
this.vaultFilter.myVaultOnly = false;
this.vaultFilter.selectedOrganizationId = null;
this.accountService.activeAccount$.subscribe((account) => {
this.setVaultFilter(this.allVaults);
});
}
getVaultFilter() {