diff --git a/core/server/data/migrations/versions/3.39/03-add-email-track-opens-setting.js b/core/server/data/migrations/versions/3.39/03-add-email-track-opens-setting.js new file mode 100644 index 0000000000..61ea8e7701 --- /dev/null +++ b/core/server/data/migrations/versions/3.39/03-add-email-track-opens-setting.js @@ -0,0 +1,16 @@ +const logging = require('../../../../../shared/logging'); +const {createTransactionalMigration} = require('../../utils'); + +module.exports = createTransactionalMigration( + + async function up(connection) { + logging.info('Updating email_track_opens setting to email group'); + await connection('settings') + .whereIn('key', ['email_track_opens']) + .update({ + group: 'email' + }); + }, + + async function down() {} +); diff --git a/core/server/data/schema/default-settings.json b/core/server/data/schema/default-settings.json index e93bc54876..46cf53a6de 100644 --- a/core/server/data/schema/default-settings.json +++ b/core/server/data/schema/default-settings.json @@ -353,6 +353,14 @@ "mailgun_base_url": { "defaultValue": null, "type": "string" + }, + "email_track_opens": { + "defaultValue": "true", + "validations": { + "isEmpty": false, + "isIn": [["true", "false"]] + }, + "type": "boolean" } }, "amp": { diff --git a/test/regression/api/canary/admin/settings_spec.js b/test/regression/api/canary/admin/settings_spec.js index 58d37ccfb0..448c249ccb 100644 --- a/test/regression/api/canary/admin/settings_spec.js +++ b/test/regression/api/canary/admin/settings_spec.js @@ -59,6 +59,7 @@ const defaultSettingsKeyTypes = [ {key: 'mailgun_api_key', type: 'bulk_email'}, {key: 'mailgun_domain', type: 'bulk_email'}, {key: 'mailgun_base_url', type: 'bulk_email'}, + {key: 'email_track_opens', type: 'bulk_email'}, {key: 'amp', type: 'blog'}, {key: 'amp_gtag_id', type: 'blog'}, {key: 'labs', type: 'blog'}, diff --git a/test/regression/api/v2/admin/settings_spec.js b/test/regression/api/v2/admin/settings_spec.js index 448b4c29ce..a0238032c9 100644 --- a/test/regression/api/v2/admin/settings_spec.js +++ b/test/regression/api/v2/admin/settings_spec.js @@ -56,6 +56,7 @@ const defaultSettingsKeyTypes = [ {key: 'mailgun_api_key', type: 'bulk_email'}, {key: 'mailgun_domain', type: 'bulk_email'}, {key: 'mailgun_base_url', type: 'bulk_email'}, + {key: 'email_track_opens', type: 'bulk_email'}, {key: 'amp', type: 'blog'}, {key: 'amp_gtag_id', type: 'blog'}, {key: 'labs', type: 'blog'}, diff --git a/test/regression/api/v3/admin/settings_spec.js b/test/regression/api/v3/admin/settings_spec.js index 1d00d125be..d0bdbab4fb 100644 --- a/test/regression/api/v3/admin/settings_spec.js +++ b/test/regression/api/v3/admin/settings_spec.js @@ -59,6 +59,7 @@ const defaultSettingsKeys = [ 'mailgun_api_key', 'mailgun_domain', 'mailgun_base_url', + 'email_track_opens', 'amp', 'amp_gtag_id', 'labs', diff --git a/test/unit/data/schema/integrity_spec.js b/test/unit/data/schema/integrity_spec.js index 04ea0ecbfc..7510e45c2f 100644 --- a/test/unit/data/schema/integrity_spec.js +++ b/test/unit/data/schema/integrity_spec.js @@ -34,7 +34,7 @@ describe('DB version integrity', function () { // Only these variables should need updating const currentSchemaHash = 'ce6d902fd2b0e3921ffb76d61a35e285'; const currentFixturesHash = 'd46d696c94d03e41a5903500547fea77'; - const currentSettingsHash = 'b7c0c2c6a4c61561dfefe642470d30f8'; + const currentSettingsHash = 'd3821715e4b34d92d6ba6ed0d4918f5c'; const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01'; // If this test is failing, then it is likely a change has been made that requires a DB version bump,