From f20653d4cade84b5802bcea233dfdb3d6e1c960a Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 5 Jun 2023 15:20:04 +0100 Subject: [PATCH] Branding fixes --- .../builder/portal/settings/branding.svelte | 14 ++++++------- .../builder/src/stores/portal/organisation.js | 6 +++--- .../src/api/controllers/global/configs.ts | 21 ++++++++++--------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/settings/branding.svelte b/packages/builder/src/pages/builder/portal/settings/branding.svelte index ed858c2228..ec2159d62b 100644 --- a/packages/builder/src/pages/builder/portal/settings/branding.svelte +++ b/packages/builder/src/pages/builder/portal/settings/branding.svelte @@ -44,7 +44,7 @@ let config = {} let updated = false - $: onConfigUpdate(config, mounted) + $: onConfigUpdate(config) $: initialised = Object.keys(config).length > 0 $: isCloud = $admin.cloud @@ -130,8 +130,6 @@ logoPreview = null } config.logoUrl = undefined - } else { - config.logoUrl = "" } if (faviconFile) { @@ -141,8 +139,6 @@ faviconPreview = null } config.faviconUrl = undefined - } else { - config.faviconUrl = "" } } @@ -190,7 +186,6 @@ if (!$organisation.loaded) { await organisation.init() } - config = { faviconUrl: $organisation.faviconUrl, logoUrl: $organisation.logoUrl, @@ -272,6 +267,7 @@ faviconFile = e.detail faviconPreview = null } else { + faviconFile = null clone.faviconUrl = "" } config = clone @@ -418,7 +414,11 @@ Upgrade {/if} - diff --git a/packages/builder/src/stores/portal/organisation.js b/packages/builder/src/stores/portal/organisation.js index bd8cf80fc1..ab33c7a5fa 100644 --- a/packages/builder/src/stores/portal/organisation.js +++ b/packages/builder/src/stores/portal/organisation.js @@ -23,7 +23,7 @@ const DEFAULT_CONFIG = { oidcCallbackUrl: "", googleCallbackUrl: "", isSSOEnforced: false, - loaded: false + loaded: false, } export function createOrganisationStore() { @@ -33,7 +33,7 @@ export function createOrganisationStore() { async function init() { const tenantId = get(auth).tenantId const settingsConfigDoc = await API.getTenantConfig(tenantId) - set({ ...DEFAULT_CONFIG, ...settingsConfigDoc.config }) + set({ ...DEFAULT_CONFIG, ...settingsConfigDoc.config, loaded: true }) } async function save(config) { @@ -59,7 +59,7 @@ export function createOrganisationStore() { subscribe, set, save, - init + init, } } diff --git a/packages/worker/src/api/controllers/global/configs.ts b/packages/worker/src/api/controllers/global/configs.ts index ec55d294f9..03da8cce88 100644 --- a/packages/worker/src/api/controllers/global/configs.ts +++ b/packages/worker/src/api/controllers/global/configs.ts @@ -22,7 +22,8 @@ import { isOIDCConfig, isSettingsConfig, isSMTPConfig, - OIDCConfigs, SettingsBrandingConfig, + OIDCConfigs, + SettingsBrandingConfig, SettingsInnerConfig, SSOConfig, SSOConfigType, @@ -336,15 +337,6 @@ export async function publicSettings( ) } - if (branding.faviconUrl && branding.faviconUrl !== "") { - // @ts-ignore - config.faviconUrl = objectStore.getGlobalFileUrl( - "settings", - "faviconUrl", - branding.faviconUrlEtag - ) - } - // google const googleConfig = await configs.getGoogleConfig() const googleDatasourceConfigured = @@ -368,6 +360,15 @@ export async function publicSettings( config: { ...config, ...branding, + ...(branding.faviconUrl && branding.faviconUrl !== "" + ? { + faviconUrl: objectStore.getGlobalFileUrl( + "settings", + "faviconUrl", + branding.faviconUrlEtag + ), + } + : { faviconUrl: undefined }), google, googleDatasourceConfigured, oidc,