diff --git a/connect/community/CustomizationOptions.ts b/connect/community/CustomizationOptions.ts index 4c154051..5494191f 100644 --- a/connect/community/CustomizationOptions.ts +++ b/connect/community/CustomizationOptions.ts @@ -156,39 +156,43 @@ export class CustomizationOptions { public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){ let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor); let updated = Object.assign({}, defaultCO); - if(current.identity && current.identity.mainColor && current.identity.secondaryColor ) { - updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); - } - if(!current.backgrounds){ - current.backgrounds = Object.assign({}, updated.backgrounds); - } - if(!current.backgrounds.dark){ - current.backgrounds.dark = Object.assign({}, updated.backgrounds.dark); - } - if(!current.backgrounds.light){ - current.backgrounds.light = Object.assign({}, updated.backgrounds.light); - } - if(!current.backgrounds.form){ - current.backgrounds.form = Object.assign({}, updated.backgrounds.form); - } - if(!current.backgrounds.form.position){ - current.backgrounds.form.position = "center bottom" - } - if(!current.buttons){ - current.buttons = Object.assign({}, updated.buttons); - } - if(!current.buttons.darkBackground){ - current.buttons.darkBackground = Object.assign({}, updated.buttons.darkBackground); - } - if(!current.buttons.lightBackground){ - current.buttons.lightBackground = Object.assign({}, updated.buttons.lightBackground); - } - if(!current.hasOwnProperty('identityIsCustom')){ - current.identityIsCustom = (JSON.stringify(current.identity) != JSON.stringify(defaultCO.identity)); - } - if(!current.hasOwnProperty('backgroundsAndButtonsIsCustom') || (!current.hasOwnProperty('backgroundsIsCustom') || (!current.hasOwnProperty('buttonsIsCustom')))){ - current.identityIsCustom = (JSON.stringify(current.backgrounds) != - JSON.stringify(updated.backgrounds) || JSON.stringify(current.buttons) != JSON.stringify(updated.buttons)) ; + if(!current){ + current = Object.assign({}, defaultCO); + }else { + if (current.identity && current.identity.mainColor && current.identity.secondaryColor) { + updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); + } + if (!current.backgrounds) { + current.backgrounds = Object.assign({}, updated.backgrounds); + } + if (!current.backgrounds.dark) { + current.backgrounds.dark = Object.assign({}, updated.backgrounds.dark); + } + if (!current.backgrounds.light) { + current.backgrounds.light = Object.assign({}, updated.backgrounds.light); + } + if (!current.backgrounds.form) { + current.backgrounds.form = Object.assign({}, updated.backgrounds.form); + } + if (!current.backgrounds.form.position) { + current.backgrounds.form.position = "center bottom" + } + if (!current.buttons) { + current.buttons = Object.assign({}, updated.buttons); + } + if (!current.buttons.darkBackground) { + current.buttons.darkBackground = Object.assign({}, updated.buttons.darkBackground); + } + if (!current.buttons.lightBackground) { + current.buttons.lightBackground = Object.assign({}, updated.buttons.lightBackground); + } + if (!current.hasOwnProperty('identityIsCustom')) { + current.identityIsCustom = (JSON.stringify(current.identity) != JSON.stringify(defaultCO.identity)); + } + if (!current.hasOwnProperty('backgroundsAndButtonsIsCustom') || (!current.hasOwnProperty('backgroundsIsCustom') || (!current.hasOwnProperty('buttonsIsCustom')))) { + current.identityIsCustom = (JSON.stringify(current.backgrounds) != + JSON.stringify(updated.backgrounds) || JSON.stringify(current.buttons) != JSON.stringify(updated.buttons)); + } } return current; diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index e720bf08..2c439aa9 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -140,6 +140,5 @@ export interface EnvProperties { myOrcidLinksPage?: string; footerGrantText?: string; egiNotebookLink?: string; - portalBuildTime?; connectPortalUrl?; }