diff --git a/connect/approvedByCommunity/approved.component.ts b/connect/approvedByCommunity/approved.component.ts index 71adfaf3..ed0520aa 100644 --- a/connect/approvedByCommunity/approved.component.ts +++ b/connect/approvedByCommunity/approved.component.ts @@ -31,11 +31,10 @@ export class ApprovedByCommunityComponent { this.route.queryParams.subscribe( communityId => { - this.communityId = communityId['communityId']; - - if(!this.communityId){ - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); - } + this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); + if(!this.communityId) { + this.communityId = communityId['communityId']; + } if(this.communityId && this.communityId != "openaire") { this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe ( diff --git a/connect/communityGuard/connectSubscriber.guard.ts b/connect/communityGuard/connectSubscriber.guard.ts index 5f04f92b..1509067f 100644 --- a/connect/communityGuard/connectSubscriber.guard.ts +++ b/connect/communityGuard/connectSubscriber.guard.ts @@ -23,8 +23,12 @@ export class ConnectSubscriberGuard implements CanActivate { return false; } else { const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => { - if(!community){ - community = ConnectHelper.getCommunityFromDomain(properties.domain); + let communityDomain = null; + //if(!community){ + communityDomain = ConnectHelper.getCommunityFromDomain(properties.domain); + //} + if(communityDomain) { + community = communityDomain; } return this.communityService.isSubscribedToCommunity( community, Session.getUserEmail(), properties["adminToolsAPIURL"]) })); diff --git a/connect/userEmailPreferences/mailPrefs.component.ts b/connect/userEmailPreferences/mailPrefs.component.ts index 6c3653f3..6fe21dd5 100644 --- a/connect/userEmailPreferences/mailPrefs.component.ts +++ b/connect/userEmailPreferences/mailPrefs.component.ts @@ -53,10 +53,9 @@ export class MailPrefsComponent { .subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.sub = this.route.queryParams.subscribe(params => { - this.communityId = params['communityId']; - - if(!this.communityId){ - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); + this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); + if(!this.communityId) { + this.communityId = params['communityId']; } this.fetchId = Session.getUserEmail(); diff --git a/error/isRouteEnabled.guard.ts b/error/isRouteEnabled.guard.ts index 86054b8c..c365e598 100644 --- a/error/isRouteEnabled.guard.ts +++ b/error/isRouteEnabled.guard.ts @@ -29,9 +29,9 @@ export class IsRouteEnabled implements CanActivate { const redirect = customRedirect ? customRedirect : '/error'; const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => { let communityDomain = null; - if (!community) { + //if (!community) { communityDomain = ConnectHelper.getCommunityFromDomain(res.domain); - } + //} if(communityDomain) { community = communityDomain; } else if (!community && data['community']) { // for openaire or connect diff --git a/utils/helper/helper.component.ts b/utils/helper/helper.component.ts index a06cf912..abf1e072 100644 --- a/utils/helper/helper.component.ts +++ b/utils/helper/helper.component.ts @@ -40,10 +40,11 @@ export class HelperComponent { this.properties = data.envSpecific; this.route.queryParams.subscribe( params => { - this.communityId = params['communityId']; - if(!this.communityId){ - this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); + this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); + if(!this.communityId) { + this.communityId = params['communityId']; } + if(!this.communityId){ this.communityId = this.properties.adminToolsCommunity; }