From 7969399cdf99fe5d99bccf82084f2c97656bfe3c Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 19 Apr 2023 14:02:03 +0200 Subject: [PATCH] Added ability to pass 'flags' field into new settings refs https://github.com/TryGhost/Ghost/commit/3b90b1f3356204d46f41f70a99de480633e1ea75 refs https://github.com/TryGhost/Team/issues/3011 - The "flags" property was missing from the allowed parameters in addSettings migrations utility method. Passing in "flags" is needed to complete a refed issue where we add a new "announcement" group of settings and two of these settings have a "PUBLIC" flag --- .../core/server/data/migrations/utils/settings.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ghost/core/core/server/data/migrations/utils/settings.js b/ghost/core/core/server/data/migrations/utils/settings.js index d0dafbdc4f..e5f1c30f57 100644 --- a/ghost/core/core/server/data/migrations/utils/settings.js +++ b/ghost/core/core/server/data/migrations/utils/settings.js @@ -6,11 +6,15 @@ const {MIGRATION_USER} = require('./constants'); /** * Creates a migration which will insert a new setting in settings table - * @param {object} settingSpec - setting key, value, group and type - * + * @param {object} settingSpec - setting type and group + * @param {string} settingSpec.key - settings key + * @param {*} settingSpec.value - settings value + * @param {'array' | 'string' | 'number' | 'boolean' | 'object'} settingSpec.type - settings type + * @param {string} settingSpec.group - settings group + * @param {'PUBLIC' | 'RO' | 'PUBLIC,RO'} [settingSpec.flags] - settings flag * @returns {Object} migration object returning config/up/down properties */ -function addSetting({key, value, type, group}) { +function addSetting({key, value, type, group, flags = null}) { return createTransactionalMigration( async function up(connection) { const settingExists = await connection('settings') @@ -31,6 +35,7 @@ function addSetting({key, value, type, group}) { value, group, type, + flags, created_at: now, created_by: MIGRATION_USER });