Branding fixes

This commit is contained in:
Dean 2023-06-05 15:20:04 +01:00
parent 42e3ca1872
commit f20653d4ca
3 changed files with 21 additions and 20 deletions

View File

@ -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
</Button>
{/if}
<Button on:click={saveConfig} cta disabled={saving || !updated || !init}>
<Button
on:click={saveConfig}
cta
disabled={saving || !updated || !$organisation.loaded}
>
Save
</Button>
</div>

View File

@ -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,
}
}

View File

@ -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,