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){
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;

View File

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