Remove local vaultFilter (#4014)

* Use vault filter item from vaultFilterService
This commit is contained in:
Justin Baur 2022-11-08 16:45:32 -05:00 committed by GitHub
parent c1b25f4389
commit 88de7d2b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 7 deletions

View File

@ -15,7 +15,6 @@ import {
} from "@angular/core"; } from "@angular/core";
import { BehaviorSubject, concatMap, map, merge, Observable, Subject, takeUntil } from "rxjs"; import { BehaviorSubject, concatMap, map, merge, Observable, Subject, takeUntil } from "rxjs";
import { VaultFilter } from "@bitwarden/angular/vault/vault-filter/models/vault-filter.model";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction"; import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service"; import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
@ -61,7 +60,6 @@ export class VaultSelectComponent implements OnInit, OnDestroy {
organizations$: Observable<Organization[]>; organizations$: Observable<Organization[]>;
selectedVault$: Observable<string | null> = this._selectedVault.asObservable(); selectedVault$: Observable<string | null> = this._selectedVault.asObservable();
vaultFilter: VaultFilter = new VaultFilter();
enforcePersonalOwnership = false; enforcePersonalOwnership = false;
overlayPostition: ConnectedPosition[] = [ overlayPostition: ConnectedPosition[] = [
{ {
@ -111,16 +109,15 @@ export class VaultSelectComponent implements OnInit, OnDestroy {
await this.vaultFilterService.checkForPersonalOwnershipPolicy(); await this.vaultFilterService.checkForPersonalOwnershipPolicy();
if (this.shouldShow(organizations)) { if (this.shouldShow(organizations)) {
if (this.enforcePersonalOwnership && !this.vaultFilter.myVaultOnly) { if (this.enforcePersonalOwnership && !this.vaultFilterService.vaultFilter.myVaultOnly) {
const firstOrganization = organizations[0]; const firstOrganization = organizations[0];
this._selectedVault.next(firstOrganization.name); this._selectedVault.next(firstOrganization.name);
this.vaultFilterService.setVaultFilter(firstOrganization.id); this.vaultFilterService.setVaultFilter(firstOrganization.id);
this.vaultFilter.selectedOrganizationId = firstOrganization.id; } else if (this.vaultFilterService.vaultFilter.myVaultOnly) {
} else if (this.vaultFilter.myVaultOnly) {
this._selectedVault.next(this.i18nService.t(this.vaultFilterService.myVault)); this._selectedVault.next(this.i18nService.t(this.vaultFilterService.myVault));
} else if (this.vaultFilter.selectedOrganizationId != null) { } else if (this.vaultFilterService.vaultFilter.selectedOrganizationId != null) {
const selectedOrganization = organizations.find( const selectedOrganization = organizations.find(
(o) => o.id === this.vaultFilter.selectedOrganizationId (o) => o.id === this.vaultFilterService.vaultFilter.selectedOrganizationId
); );
this._selectedVault.next(selectedOrganization.name); this._selectedVault.next(selectedOrganization.name);
} else { } else {