From 6f24772f49fc373678f6e62e9e6eacabb02bf226 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 23 Jun 2023 16:40:40 +0100 Subject: [PATCH] PR Feedback --- .../builder/auth/_components/OIDCButton.svelte | 8 +++----- .../src/api/controllers/global/configs.ts | 18 ++++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte index 9d0ab515fb..f5dcbe7466 100644 --- a/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte +++ b/packages/builder/src/pages/builder/auth/_components/OIDCButton.svelte @@ -12,7 +12,6 @@ export let samePage $: show = $organisation.oidc - $: oidcLogoCheck = $oidc.logo let preDefinedIcons = { Oidc: OidcLogo, @@ -30,14 +29,13 @@ } }) - $: src = !oidcLogoCheck - ? OidcLogo - : preDefinedIcons[$oidc.logo] || oidcLogoCheck + $: oidcLogoImageURL = preDefinedIcons[$oidc.logo] ?? $oidc.logo + $: logoSrc = oidcLogoImageURL ?? OidcLogo {#if show} { const url = `/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}` if (samePage) { diff --git a/packages/worker/src/api/controllers/global/configs.ts b/packages/worker/src/api/controllers/global/configs.ts index a7d5bac989..042fcb9393 100644 --- a/packages/worker/src/api/controllers/global/configs.ts +++ b/packages/worker/src/api/controllers/global/configs.ts @@ -327,23 +327,21 @@ export async function find(ctx: UserCtx) { export async function publicOidc(ctx: Ctx) { try { // Find the config with the most granular scope based on context - const config = await configs.getOIDCConfig() - const oidcLogoConfig = await configs.getOIDCLogosDoc() + const oidcConfig = await configs.getOIDCConfig() + const oidcCustomLogos = await configs.getOIDCLogosDoc() - if (oidcLogoConfig) { - enrichOIDCLogos(oidcLogoConfig) + if (oidcCustomLogos) { + enrichOIDCLogos(oidcCustomLogos) } - if (!config) { + if (!oidcConfig) { ctx.body = [] } else { ctx.body = [ { - logo: oidcLogoConfig - ? oidcLogoConfig.config[config.logo] - : config.logo, - name: config.name, - uuid: config.uuid, + logo: oidcCustomLogos?.config[oidcConfig.logo] ?? oidcConfig.logo, + name: oidcConfig.name, + uuid: oidcConfig.uuid, }, ] }