update Customization Options

remove unused property portalBuildTime
This commit is contained in:
argirok 2022-08-08 13:16:13 +03:00
parent 7069fe6151
commit 123766d46e
2 changed files with 37 additions and 34 deletions

View File

@ -156,39 +156,43 @@ export class CustomizationOptions {
public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){ public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){
let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor); let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor);
let updated = Object.assign({}, defaultCO); let updated = Object.assign({}, defaultCO);
if(current.identity && current.identity.mainColor && current.identity.secondaryColor ) { if(!current){
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); current = Object.assign({}, defaultCO);
} }else {
if(!current.backgrounds){ if (current.identity && current.identity.mainColor && current.identity.secondaryColor) {
current.backgrounds = Object.assign({}, updated.backgrounds); updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
} }
if(!current.backgrounds.dark){ if (!current.backgrounds) {
current.backgrounds.dark = Object.assign({}, updated.backgrounds.dark); current.backgrounds = Object.assign({}, updated.backgrounds);
} }
if(!current.backgrounds.light){ if (!current.backgrounds.dark) {
current.backgrounds.light = Object.assign({}, updated.backgrounds.light); current.backgrounds.dark = Object.assign({}, updated.backgrounds.dark);
} }
if(!current.backgrounds.form){ if (!current.backgrounds.light) {
current.backgrounds.form = Object.assign({}, updated.backgrounds.form); current.backgrounds.light = Object.assign({}, updated.backgrounds.light);
} }
if(!current.backgrounds.form.position){ if (!current.backgrounds.form) {
current.backgrounds.form.position = "center bottom" current.backgrounds.form = Object.assign({}, updated.backgrounds.form);
} }
if(!current.buttons){ if (!current.backgrounds.form.position) {
current.buttons = Object.assign({}, updated.buttons); current.backgrounds.form.position = "center bottom"
} }
if(!current.buttons.darkBackground){ if (!current.buttons) {
current.buttons.darkBackground = Object.assign({}, updated.buttons.darkBackground); current.buttons = Object.assign({}, updated.buttons);
} }
if(!current.buttons.lightBackground){ if (!current.buttons.darkBackground) {
current.buttons.lightBackground = Object.assign({}, updated.buttons.lightBackground); current.buttons.darkBackground = Object.assign({}, updated.buttons.darkBackground);
} }
if(!current.hasOwnProperty('identityIsCustom')){ if (!current.buttons.lightBackground) {
current.identityIsCustom = (JSON.stringify(current.identity) != JSON.stringify(defaultCO.identity)); current.buttons.lightBackground = Object.assign({}, updated.buttons.lightBackground);
} }
if(!current.hasOwnProperty('backgroundsAndButtonsIsCustom') || (!current.hasOwnProperty('backgroundsIsCustom') || (!current.hasOwnProperty('buttonsIsCustom')))){ if (!current.hasOwnProperty('identityIsCustom')) {
current.identityIsCustom = (JSON.stringify(current.backgrounds) != current.identityIsCustom = (JSON.stringify(current.identity) != JSON.stringify(defaultCO.identity));
JSON.stringify(updated.backgrounds) || JSON.stringify(current.buttons) != JSON.stringify(updated.buttons)) ; }
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; return current;

View File

@ -140,6 +140,5 @@ export interface EnvProperties {
myOrcidLinksPage?: string; myOrcidLinksPage?: string;
footerGrantText?: string; footerGrantText?: string;
egiNotebookLink?: string; egiNotebookLink?: string;
portalBuildTime?;
connectPortalUrl?; connectPortalUrl?;
} }