Fix community logoUrl bug when it is uploaded
This commit is contained in:
parent
23f9f2c768
commit
79e6748d7f
|
@ -98,6 +98,6 @@ export class CommunitiesService {
|
|||
communities.push(result);
|
||||
}
|
||||
}
|
||||
return communities;
|
||||
return CommunityInfo.checkIsUpload(communities);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,18 +55,6 @@ export class CommunityService {
|
|||
return this.community.getValue();
|
||||
}
|
||||
|
||||
private checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
|
||||
if (Array.isArray(response)) {
|
||||
response.forEach(value => {
|
||||
value.isUpload = value.logoUrl && !StringUtils.isValidUrl(value.logoUrl);
|
||||
});
|
||||
} else {
|
||||
response.isUpload = response.logoUrl && !StringUtils.isValidUrl(response.logoUrl);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
updateCommunity(url: string, community: any) {
|
||||
if (!community.logoUrl) {
|
||||
community.logoUrl = '';
|
||||
|
@ -131,7 +119,7 @@ export class CommunityService {
|
|||
community.subjects[i] = subject;
|
||||
}
|
||||
}
|
||||
return this.checkIsUpload(community);
|
||||
return CommunityInfo.checkIsUpload(community);
|
||||
}
|
||||
|
||||
isRIType(community: string): Observable<boolean> {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
import {StringUtils} from "../../utils/string-utils.class";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
|
||||
export class CommunityInfo {
|
||||
title: string;
|
||||
shortTitle:string;
|
||||
|
@ -14,5 +17,20 @@ export class CommunityInfo {
|
|||
isUpload: boolean;
|
||||
isSubscribed: boolean;
|
||||
isManager: boolean;
|
||||
|
||||
getLogoUrl() {
|
||||
return (this.isUpload?(properties.utilsService + '/download/' + this.logoUrl):this.logoUrl);
|
||||
}
|
||||
|
||||
public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
|
||||
if (Array.isArray(response)) {
|
||||
response.forEach(value => {
|
||||
value.isUpload = value.logoUrl && !StringUtils.isValidUrl(value.logoUrl);
|
||||
});
|
||||
} else {
|
||||
response.isUpload = response.logoUrl && !StringUtils.isValidUrl(response.logoUrl);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
// export const prodReadyCommunities = ["dh-ch", "ee", "fam", "mes", "ni", "covid-19", "dariah", "epos", "egi"];
|
||||
|
|
|
@ -147,7 +147,7 @@ export class RelatedToComponent implements OnInit {
|
|||
context.link = url;
|
||||
// grabbing the logoUrl for the gateway links
|
||||
if(community.logoUrl) {
|
||||
context.logo = community.logoUrl;
|
||||
context.logo = community.getLogoUrl();
|
||||
}
|
||||
for(let gateway of this.gateways) {
|
||||
if(gateway.link == context.link) {
|
||||
|
|
Loading…
Reference in New Issue