From 5c209abdc0a452233899c0c486454065aa8a82da Mon Sep 17 00:00:00 2001 From: Rishabh Garg Date: Tue, 6 Jun 2023 18:15:01 +0530 Subject: [PATCH] Updated default value for image editor integration setting (#16897) refs https://github.com/TryGhost/Team/issues/3145 Updates pintura integration to be switched on by default for all sites by adding a migration to update the default value for the setting. --- ...2023-05-30-19-03-update-pintura-setting.js | 19 +++++++++++++++++++ .../default-settings/default-settings.json | 2 +- .../admin/__snapshots__/settings.test.js.snap | 16 ++++++++-------- .../unit/server/data/schema/integrity.test.js | 2 +- .../test/utils/fixtures/default-settings.json | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 ghost/core/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js diff --git a/ghost/core/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js b/ghost/core/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js new file mode 100644 index 0000000000..5b6e16d421 --- /dev/null +++ b/ghost/core/core/server/data/migrations/versions/5.51/2023-05-30-19-03-update-pintura-setting.js @@ -0,0 +1,19 @@ +const logging = require('@tryghost/logging'); +const {createTransactionalMigration} = require('../../utils'); + +module.exports = createTransactionalMigration( + async function up(knex) { + logging.info('Updating setting: "pintura" to "true"'); + await knex('settings') + .where({ + key: 'pintura' + }) + .update({ + value: 'true' + }); + }, + + async function down() { + // no-op: this is a one way migration to set the default value for pintura integration + } +); diff --git a/ghost/core/core/server/data/schema/default-settings/default-settings.json b/ghost/core/core/server/data/schema/default-settings/default-settings.json index 4951275b12..18b2ee5cc7 100644 --- a/ghost/core/core/server/data/schema/default-settings/default-settings.json +++ b/ghost/core/core/server/data/schema/default-settings/default-settings.json @@ -530,7 +530,7 @@ }, "pintura": { "pintura": { - "defaultValue": "false", + "defaultValue": "true", "validations": { "isIn": [ [ diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap index b5e678c2db..8aab15fb3b 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -294,7 +294,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -684,7 +684,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -718,7 +718,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "3993", + "content-length": "3992", "content-type": "application/json; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, @@ -1022,7 +1022,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -1359,7 +1359,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -1701,7 +1701,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -2131,7 +2131,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", @@ -2533,7 +2533,7 @@ Object { }, Object { "key": "pintura", - "value": false, + "value": true, }, Object { "key": "pintura_js_url", diff --git a/ghost/core/test/unit/server/data/schema/integrity.test.js b/ghost/core/test/unit/server/data/schema/integrity.test.js index b70b1d775b..3039cf65b4 100644 --- a/ghost/core/test/unit/server/data/schema/integrity.test.js +++ b/ghost/core/test/unit/server/data/schema/integrity.test.js @@ -37,7 +37,7 @@ describe('DB version integrity', function () { // Only these variables should need updating const currentSchemaHash = '2445c734ffb514d11b56e74591bcde4e'; const currentFixturesHash = '869ceb3302303494c645f4201540ead3'; - const currentSettingsHash = 'f9db81a9d2fe2fed5e9cfda1ccd2b3cc'; + const currentSettingsHash = '4f23a583335dcb4cb3fae553122ea200'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; // If this test is failing, then it is likely a change has been made that requires a DB version bump, diff --git a/ghost/core/test/utils/fixtures/default-settings.json b/ghost/core/test/utils/fixtures/default-settings.json index 1fd035c37b..b920c22b7d 100644 --- a/ghost/core/test/utils/fixtures/default-settings.json +++ b/ghost/core/test/utils/fixtures/default-settings.json @@ -538,7 +538,7 @@ }, "pintura": { "pintura": { - "defaultValue": "false", + "defaultValue": "true", "validations": { "isIn": [ [