1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

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.cipherService,
this.collectionService, this.collectionService,
this.policyService, this.policyService,
this.accountService,
); );
this.vaultTimeoutService = new VaultTimeoutService( this.vaultTimeoutService = new VaultTimeoutService(

View File

@ -431,6 +431,7 @@ function getBgService<T>(service: keyof MainBackground) {
organizationService: OrganizationService, organizationService: OrganizationService,
folderService: FolderService, folderService: FolderService,
policyService: PolicyService, policyService: PolicyService,
accountService: AccountServiceAbstraction,
) => { ) => {
return new VaultFilterService( return new VaultFilterService(
stateService, stateService,
@ -439,9 +440,16 @@ function getBgService<T>(service: keyof MainBackground) {
getBgService<CipherService>("cipherService")(), getBgService<CipherService>("cipherService")(),
getBgService<CollectionService>("collectionService")(), getBgService<CollectionService>("collectionService")(),
policyService, policyService,
accountService,
); );
}, },
deps: [StateServiceAbstraction, OrganizationService, FolderService, PolicyService], deps: [
StateServiceAbstraction,
OrganizationService,
FolderService,
PolicyService,
AccountServiceAbstraction,
],
}, },
{ {
provide: ProviderService, 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 { 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 { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.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 { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service"; import { CollectionService } from "@bitwarden/common/vault/abstractions/collection.service";
@ -21,6 +22,7 @@ export class VaultFilterService extends BaseVaultFilterService {
cipherService: CipherService, cipherService: CipherService,
collectionService: CollectionService, collectionService: CollectionService,
policyService: PolicyService, policyService: PolicyService,
private accountService: AccountService,
) { ) {
super( super(
stateService, stateService,
@ -32,6 +34,10 @@ export class VaultFilterService extends BaseVaultFilterService {
); );
this.vaultFilter.myVaultOnly = false; this.vaultFilter.myVaultOnly = false;
this.vaultFilter.selectedOrganizationId = null; this.vaultFilter.selectedOrganizationId = null;
this.accountService.activeAccount$.subscribe((account) => {
this.setVaultFilter(this.allVaults);
});
} }
getVaultFilter() { getVaultFilter() {