From 77f285703f6ffc74ac395007fc9922c821a6736c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 15 Apr 2019 09:16:29 +0000 Subject: [PATCH] [Trunk|Connect]: Search Communities: Remove status and role filters when user logged out git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55352 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../searchCommunities.component.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/app/searchPages/communities/searchCommunities.component.ts b/src/app/searchPages/communities/searchCommunities.component.ts index efe4bd3..585be0c 100644 --- a/src/app/searchPages/communities/searchCommunities.component.ts +++ b/src/app/searchPages/communities/searchCommunities.component.ts @@ -240,20 +240,24 @@ export class SearchCommunitiesComponent { */ private checkFilters(params: Map) { let typeResults: CommunityInfo[] = this.applyFilter('type', params); - let statusResults: CommunityInfo[] = this.applyFilter('status' , params); - let roleResults: CommunityInfo[] = this.applyFilter('role', params); - this.resetFilterNumbers('status'); - this.updateFilterNumbers(typeResults.filter(value => { - return roleResults.includes(value); - }), 'status'); + let statusResults: CommunityInfo[] = this.results; + let roleResults: CommunityInfo[] = this.results; + if(Session.isLoggedIn()) { + statusResults = this.applyFilter('status', params); + roleResults = this.applyFilter('role', params); + this.resetFilterNumbers('status'); + this.updateFilterNumbers(typeResults.filter(value => { + return roleResults.includes(value); + }), 'status'); + this.resetFilterNumbers('role'); + this.updateFilterNumbers(statusResults.filter(value => { + return typeResults.includes(value); + }), 'role'); + } this.resetFilterNumbers('type'); this.updateFilterNumbers(statusResults.filter(value => { return roleResults.includes(value); }), 'type'); - this.resetFilterNumbers('role'); - this.updateFilterNumbers(statusResults.filter(value => { - return typeResults.includes(value); - }), 'role'); this.results = statusResults.filter(value => { return typeResults.includes(value); })