Portal search results fix hasPersmission method. Add private icon in hidden communities
This commit is contained in:
parent
045665ae10
commit
02efeb4038
|
@ -12,11 +12,16 @@
|
|||
<span>Private</span>
|
||||
</div> -->
|
||||
</div>
|
||||
<div *ngIf="type === 'community' && result.status == 'manager'"
|
||||
<div *ngIf="type === 'community' && result.status === 'manager'"
|
||||
class="uk-position-top-right uk-margin-small-top uk-margin-right uk-flex uk-flex-middle">
|
||||
<icon [name]="visibilityIcon.get('RESTRICTED')"></icon>
|
||||
<span class="space uk-text-small uk-text-capitalize">restricted</span>
|
||||
</div>
|
||||
<div *ngIf="type === 'community' && result.status === 'hidden'"
|
||||
class="uk-position-top-right uk-margin-small-top uk-margin-right uk-flex uk-flex-middle">
|
||||
<icon [name]="visibilityIcon.get('PRIVATE')"></icon>
|
||||
<span class="space uk-text-small uk-text-capitalize">private</span>
|
||||
</div>
|
||||
<div *ngIf="result.visibility && result.visibility !== 'PUBLIC'"
|
||||
class="uk-position-top-right uk-margin-small-top uk-margin-right uk-flex uk-flex-middle">
|
||||
<icon [name]="visibilityIcon.get(result.visibility)"></icon>
|
||||
|
|
|
@ -51,19 +51,20 @@ export class PortalSearchResultComponent implements OnInit{
|
|||
}
|
||||
|
||||
hasPermission(result: CommunityInfo & StakeholderInfo) {
|
||||
if(result.status == "manager") {
|
||||
return false;
|
||||
}
|
||||
return this.type === "community" || result.visibility === "PUBLIC" || result.isManager || result.isMember;
|
||||
if(this.type === "community") {
|
||||
return result.status === "all" || (result.status === "manager" && result.isManager);
|
||||
} else if(this.type === "stakeholder") {
|
||||
return result.visibility === "PUBLIC" || (result.visibility === "RESTRICTED" && (result.isManager || result.isMember)) ||
|
||||
(result.visibility === "PRIVATE" || result.isManager);
|
||||
}
|
||||
}
|
||||
|
||||
getProductionPrefix(id:string): string {
|
||||
getEnvironmentPrefix(): string {
|
||||
return (this.properties.environment == "production") ? "" : "beta.";
|
||||
}
|
||||
|
||||
isProduction(): boolean {
|
||||
return this.properties.environment != "development";
|
||||
|
||||
}
|
||||
|
||||
public _formatDescription(description) {
|
||||
|
@ -91,7 +92,7 @@ export class PortalSearchResultComponent implements OnInit{
|
|||
public getCommunityPageUrl(communityInfo: CommunityInfo): string {
|
||||
let url = '';
|
||||
if (this.isProduction()) {
|
||||
url = 'https://' + this.getProductionPrefix(communityInfo.communityId ) + communityInfo.communityId + '.openaire.eu';
|
||||
url = 'https://' + this.getEnvironmentPrefix() + communityInfo.communityId + '.openaire.eu';
|
||||
} else {
|
||||
url = this.router.createUrlTree(['/'], {
|
||||
queryParams: {'communityId': communityInfo.communityId}
|
||||
|
|
Loading…
Reference in New Issue