From f95b550b15274cf4c7a2c58c14807fb835dccbbb Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 23 Jul 2021 14:40:22 +0100 Subject: [PATCH 1/2] Mark google activated by default for old configs --- .../src/api/controllers/admin/configs.js | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index 4e907ed356..78d5fdd061 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -150,14 +150,24 @@ exports.publicSettings = async function (ctx) { } // google button flag - const googleActivated = - googleConfig.config.activated == undefined || // activated by default for configs pre-activated flag - googleConfig.config.activated - config.config.google = !googleConfig ? false : googleActivated + if (googleConfig && googleConfig.config) { + const googleActivated = + googleConfig.config.activated == undefined || // activated by default for configs pre-activated flag + googleConfig.config.activated + config.config.google = googleActivated + } else { + config.config.google = false + } + // oidc button flag - const oidcActivated = !oidcConfig.config.configs[0].activated - config.config.oidc = !oidcConfig ? false : oidcActivated + if (oidcConfig && oidcConfig.config) { + const oidcActivated = oidcConfig.config.configs[0].activated + config.config.oidc = oidcActivated + } else { + config.config.oidc = false + } + ctx.body = config } catch (err) { From 418637cb6b979ad1d5e18a1bbac18dfbd10fdb5d Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 23 Jul 2021 14:42:28 +0100 Subject: [PATCH 2/2] Linting --- packages/worker/src/api/controllers/admin/configs.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index 78d5fdd061..78caa817b2 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -158,7 +158,6 @@ exports.publicSettings = async function (ctx) { } else { config.config.google = false } - // oidc button flag if (oidcConfig && oidcConfig.config) { @@ -167,7 +166,6 @@ exports.publicSettings = async function (ctx) { } else { config.config.oidc = false } - ctx.body = config } catch (err) {