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';
|
||||
if (resData.hasOwnProperty('status')) {
|
||||
result['status'] = resData.status;
|
||||
const status = ['all', 'hidden', 'manager'];
|
||||
if (status.indexOf(result['status']) === -1) {
|
||||
result['status'] = 'hidden';
|
||||
}
|
||||
result.validateStatus();
|
||||
}
|
||||
if (resData.type != null) {
|
||||
result['type'] = resData.type;
|
||||
|
|
|
@ -103,10 +103,7 @@ export class CommunityService {
|
|||
community.otherZenodoCommunities = resData.otherZenodoCommunities;
|
||||
if (resData.hasOwnProperty('status')) {
|
||||
community.status = resData.status;
|
||||
const status = ['all', 'hidden', 'manager'];
|
||||
if(!( community.isPrivate() || community.isRestricted() || community.isPublic())) {
|
||||
community.status = 'PRIVATE';
|
||||
}
|
||||
community.validateStatus();
|
||||
}
|
||||
if (resData.subjects != null) {
|
||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||
|
|
|
@ -43,5 +43,10 @@ export class CommunityInfo {
|
|||
public isPrivate(){
|
||||
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"];
|
||||
|
|
Loading…
Reference in New Issue