Remove dev condition for relatedTo component

This commit is contained in:
Alex Martzios 2021-11-24 16:52:58 +02:00
parent de6c91cbab
commit 130691b60a
1 changed files with 41 additions and 43 deletions

View File

@ -11,7 +11,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
@Component({
selector: 'relatedTo',
template: `
<div class="sideInfoTitle">
<div *ngIf="(gateways && gateways.length > 0) || (otherCommunities && otherCommunities.length > 0)" class="sideInfoTitle">
<span>Communities</span>
</div>
<!-- If there are any communities with dashboard -->
@ -169,52 +169,50 @@ export class RelatedToComponent implements OnInit {
ngOnInit() {
this.contexts.sort(this.compare);
if(properties.environment === "development") {
let index = 0;
this.contexts.forEach( context => {
if(context.idContext) {
this.subscriptions.push(
this.userManagementService.getUserInfo().subscribe( user => {
//- handling subscribe errors?
this.subscriptions.push(
this.communityService.getCommunity(context.idContext).subscribe( community => {
if(community && !ConnectHelper.isPrivate(community,user) && (this.currentCommunity != context.idContext)) {
// creating the link, based on the enviroment
let url = '';
if(properties.environment == "beta") {
url = 'https://beta.' + context.idContext + '.openaire.eu';
} else {
url = 'https://' + context.idContext + '.openaire.eu';
}
context.link = url;
for(let gateway of this.gateways) {
if(gateway.link == context.link) {
return; // skips so that we don't get duplicate gateways
}
}
this.gateways.push(context);
let index = 0;
this.contexts.forEach( context => {
if(context.idContext) {
this.subscriptions.push(
this.userManagementService.getUserInfo().subscribe( user => {
//- handling subscribe errors?
this.subscriptions.push(
this.communityService.getCommunity(context.idContext).subscribe( community => {
if(community && !ConnectHelper.isPrivate(community,user) && (this.currentCommunity != context.idContext)) {
// creating the link, based on the enviroment
let url = '';
if(properties.environment == "beta") {
url = 'https://beta.' + context.idContext + '.openaire.eu';
} else {
if(this.currentCommunity != context.idContext) {
for(let other of this.otherCommunities) {
if(other.idContext == context.idContext) {
return; // skips so that we don't get duplicate communities because of the multiple concepts
}
url = 'https://' + context.idContext + '.openaire.eu';
}
context.link = url;
for(let gateway of this.gateways) {
if(gateway.link == context.link) {
return; // skips so that we don't get duplicate gateways
}
}
this.gateways.push(context);
} else {
if(this.currentCommunity != context.idContext) {
for(let other of this.otherCommunities) {
if(other.idContext == context.idContext) {
return; // skips so that we don't get duplicate communities because of the multiple concepts
}
}
this.otherCommunities.push(context);
}
index++;
if(index == this.contexts.length) {
this.gateways.sort(this.compare);
this.otherCommunities.sort(this.compare);
}
})
);
})
);
}
});
}
this.otherCommunities.push(context);
}
index++;
if(index == this.contexts.length) {
this.gateways.sort(this.compare);
this.otherCommunities.sort(this.compare);
}
})
);
})
);
}
});
}
ngOnDestroy() {