use methods isPublic, isRestricted, isPrivate instead of using the previous checks and add validateStatus method
This commit is contained in:
parent
7354d0ad55
commit
c8c5e2d925
|
@ -58,10 +58,7 @@ export class CommunitiesService {
|
||||||
result['status'] = 'all';
|
result['status'] = 'all';
|
||||||
if (resData.hasOwnProperty('status')) {
|
if (resData.hasOwnProperty('status')) {
|
||||||
result['status'] = resData.status;
|
result['status'] = resData.status;
|
||||||
const status = ['all', 'hidden', 'manager'];
|
result.validateStatus();
|
||||||
if (status.indexOf(result['status']) === -1) {
|
|
||||||
result['status'] = 'hidden';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (resData.type != null) {
|
if (resData.type != null) {
|
||||||
result['type'] = resData.type;
|
result['type'] = resData.type;
|
||||||
|
|
|
@ -103,10 +103,7 @@ export class CommunityService {
|
||||||
community.otherZenodoCommunities = resData.otherZenodoCommunities;
|
community.otherZenodoCommunities = resData.otherZenodoCommunities;
|
||||||
if (resData.hasOwnProperty('status')) {
|
if (resData.hasOwnProperty('status')) {
|
||||||
community.status = resData.status;
|
community.status = resData.status;
|
||||||
const status = ['all', 'hidden', 'manager'];
|
community.validateStatus();
|
||||||
if(!( community.isPrivate() || community.isRestricted() || community.isPublic())) {
|
|
||||||
community.status = 'PRIVATE';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (resData.subjects != null) {
|
if (resData.subjects != null) {
|
||||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||||
|
|
|
@ -43,5 +43,10 @@ export class CommunityInfo {
|
||||||
public isPrivate(){
|
public isPrivate(){
|
||||||
return this.status == "hidden" || this.status == "PRIVATE";
|
return this.status == "hidden" || this.status == "PRIVATE";
|
||||||
}
|
}
|
||||||
|
public validateStatus(){
|
||||||
|
if(!(this.isPrivate() || this.isRestricted() || this.isPublic())){
|
||||||
|
this.status = "PRIVATE";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// export const prodReadyCommunities = ["dh-ch", "ee", "fam", "mes", "ni", "covid-19", "dariah", "epos", "egi"];
|
// export const prodReadyCommunities = ["dh-ch", "ee", "fam", "mes", "ni", "covid-19", "dariah", "epos", "egi"];
|
||||||
|
|
Loading…
Reference in New Issue