From a89b745f0ba413fddd84481fea9a00ffd7ccb772 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Wed, 29 Jun 2022 15:12:08 -0500 Subject: [PATCH] [EC-282/EC-286] Update queryParams to use new filter object (#2985) * [EC-282] Update queryParams to use new filter object * Removed unused properties * Removed unused method/property for organization vault * Fixed organization trash filter --- .../individual-vault.component.ts | 12 ++++-------- .../organization-vault.component.ts | 17 +++++++---------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/apps/web/src/app/modules/vault/modules/individual-vault/individual-vault.component.ts b/apps/web/src/app/modules/vault/modules/individual-vault/individual-vault.component.ts index 3e1b379636..7178578da8 100644 --- a/apps/web/src/app/modules/vault/modules/individual-vault/individual-vault.component.ts +++ b/apps/web/src/app/modules/vault/modules/individual-vault/individual-vault.component.ts @@ -57,16 +57,12 @@ export class IndividualVaultComponent implements OnInit, OnDestroy { @ViewChild("updateKeyTemplate", { read: ViewContainerRef, static: true }) updateKeyModalRef: ViewContainerRef; - favorites = false; folderId: string = null; - collectionId: string = null; - organizationId: string = null; myVaultOnly = false; showVerifyEmail = false; showBrowserOutdated = false; showUpdateKey = false; showPremiumCallout = false; - deleted = false; trashCleanupWarning: string = null; activeFilter: VaultFilter = new VaultFilter(); @@ -402,11 +398,11 @@ export class IndividualVaultComponent implements OnInit, OnDestroy { private go(queryParams: any = null) { if (queryParams == null) { queryParams = { - favorites: this.favorites ? true : null, + favorites: this.activeFilter.status === "favorites" ? true : null, type: this.activeFilter.cipherType, - folderId: this.folderId, - collectionId: this.collectionId, - deleted: this.deleted ? true : null, + folderId: this.activeFilter.selectedFolderId, + collectionId: this.activeFilter.selectedCollectionId, + deleted: this.activeFilter.status === "trash" ? true : null, }; } diff --git a/apps/web/src/app/modules/vault/modules/organization-vault/organization-vault.component.ts b/apps/web/src/app/modules/vault/modules/organization-vault/organization-vault.component.ts index 295100fd9d..088c1370e7 100644 --- a/apps/web/src/app/modules/vault/modules/organization-vault/organization-vault.component.ts +++ b/apps/web/src/app/modules/vault/modules/organization-vault/organization-vault.component.ts @@ -54,7 +54,6 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy { organization: Organization; collectionId: string = null; type: CipherType = null; - deleted = false; trashCleanupWarning: string = null; activeFilter: VaultFilter = new VaultFilter(); @@ -152,6 +151,10 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy { }); } + get deleted(): boolean { + return this.activeFilter.status === "trash"; + } + ngOnDestroy() { this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); } @@ -171,7 +174,7 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy { if (this.activeFilter.status === "favorites" && cipherPassesFilter) { cipherPassesFilter = cipher.favorite; } - if (this.activeFilter.status === "trash" && cipherPassesFilter) { + if (this.deleted && cipherPassesFilter) { cipherPassesFilter = cipher.isDeleted; } if (this.activeFilter.cipherType != null && cipherPassesFilter) { @@ -331,17 +334,11 @@ export class OrganizationVaultComponent implements OnInit, OnDestroy { }); } - private clearFilters() { - this.collectionId = null; - this.type = null; - this.deleted = false; - } - private go(queryParams: any = null) { if (queryParams == null) { queryParams = { - type: this.type, - collectionId: this.collectionId, + type: this.activeFilter.cipherType, + collectionId: this.activeFilter.selectedCollectionId, deleted: this.deleted ? true : null, }; }