diff --git a/core/server/api/canary/utils/serializers/input/settings.js b/core/server/api/canary/utils/serializers/input/settings.js index 6e230bbb9a..c63ae8def2 100644 --- a/core/server/api/canary/utils/serializers/input/settings.js +++ b/core/server/api/canary/utils/serializers/input/settings.js @@ -71,14 +71,6 @@ module.exports = { }, read(apiConfig, frame) { - if (frame.options.key === 'ghost_head') { - frame.options.key = 'codeinjection_head'; - } - - if (frame.options.key === 'ghost_foot') { - frame.options.key = 'codeinjection_foot'; - } - if (frame.options.key === 'active_timezone') { frame.options.key = 'timezone'; } @@ -141,14 +133,6 @@ module.exports = { setting.value = setting.value === 'true'; } - if (setting.key === 'ghost_head') { - setting.key = 'codeinjection_head'; - } - - if (setting.key === 'ghost_foot') { - setting.key = 'codeinjection_foot'; - } - if (setting.key === 'active_timezone') { setting.key = 'timezone'; } diff --git a/core/server/api/canary/utils/serializers/output/mappers/settings.js b/core/server/api/canary/utils/serializers/output/mappers/settings.js index e10679210f..3b067d1160 100644 --- a/core/server/api/canary/utils/serializers/output/mappers/settings.js +++ b/core/server/api/canary/utils/serializers/output/mappers/settings.js @@ -12,7 +12,7 @@ module.exports = (attrs, frame) => { // `forSettings` step. This logic can be rewritten once we get rid of deprecated // fields completely. if (_.isArray(attrs)) { - const keysToFilter = ['ghost_head', 'ghost_foot']; + const keysToFilter = []; // NOTE: to support edits of deprecated 'slack' setting artificial 'slack_url' and 'slack_username' // were added to the request body in the input serializer. These should not be returned in response diff --git a/core/server/api/canary/utils/serializers/output/utils/extra-attrs.js b/core/server/api/canary/utils/serializers/output/utils/extra-attrs.js index b31e205ee1..b20cbd459a 100644 --- a/core/server/api/canary/utils/serializers/output/utils/extra-attrs.js +++ b/core/server/api/canary/utils/serializers/output/utils/extra-attrs.js @@ -40,16 +40,6 @@ module.exports.forSettings = (attrs, frame) => { if (_.isArray(attrs)) { // CASE: read single setting if (frame.original.params && frame.original.params.key) { - if (frame.original.params.key === 'ghost_head') { - attrs[0].key = 'ghost_head'; - return; - } - - if (frame.original.params.key === 'ghost_foot') { - attrs[0].key = 'ghost_foot'; - return; - } - if (frame.original.params.key === 'active_timezone') { attrs[0].key = 'active_timezone'; return; @@ -76,13 +66,7 @@ module.exports.forSettings = (attrs, frame) => { // CASE: edit if (frame.original.body && frame.original.body.settings) { frame.original.body.settings.forEach((setting) => { - if (setting.key === 'ghost_head') { - const target = _.find(attrs, {key: 'codeinjection_head'}); - target.key = 'ghost_head'; - } else if (setting.key === 'ghost_foot') { - const target = _.find(attrs, {key: 'codeinjection_foot'}); - target.key = 'ghost_foot'; - } else if (setting.key === 'active_timezone') { + if (setting.key === 'active_timezone') { const target = _.find(attrs, {key: 'timezone'}); target.key = 'active_timezone'; } else if (setting.key === 'default_locale') { @@ -112,24 +96,12 @@ module.exports.forSettings = (attrs, frame) => { } // CASE: browse all settings, add extra keys and keep deprecated - const ghostHead = _.cloneDeep(_.find(attrs, {key: 'codeinjection_head'})); - const ghostFoot = _.cloneDeep(_.find(attrs, {key: 'codeinjection_foot'})); const timezone = _.cloneDeep(_.find(attrs, {key: 'timezone'})); const lang = _.cloneDeep(_.find(attrs, {key: 'lang'})); const slackURL = _.cloneDeep(_.find(attrs, {key: 'slack_url'})); const slackUsername = _.cloneDeep(_.find(attrs, {key: 'slack_username'})); const locale = _.cloneDeep(_.find(attrs, {key: 'lang'})); - if (ghostHead) { - ghostHead.key = 'ghost_head'; - attrs.push(ghostHead); - } - - if (ghostFoot) { - ghostFoot.key = 'ghost_foot'; - attrs.push(ghostFoot); - } - if (timezone) { timezone.key = 'active_timezone'; attrs.push(timezone); diff --git a/core/server/api/canary/utils/validators/input/settings.js b/core/server/api/canary/utils/validators/input/settings.js index 801fd480b2..af82ff8353 100644 --- a/core/server/api/canary/utils/validators/input/settings.js +++ b/core/server/api/canary/utils/validators/input/settings.js @@ -1,7 +1,6 @@ const Promise = require('bluebird'); const _ = require('lodash'); -const tpl = require('@tryghost/tpl'); -const {NotFoundError, ValidationError, BadRequestError} = require('@tryghost/errors'); +const {ValidationError, BadRequestError} = require('@tryghost/errors'); const validator = require('@tryghost/validator'); const messages = { @@ -11,30 +10,10 @@ const messages = { }; module.exports = { - read(apiConfig, frame) { - // @NOTE: was removed https://github.com/TryGhost/Ghost/issues/10373 - if (frame.options.key === 'ghost_head' || frame.options.key === 'ghost_foot') { - return Promise.reject(new NotFoundError({ - message: tpl(messages.problemFindingSetting, { - key: frame.options.key - }) - })); - } - }, - edit(apiConfig, frame) { const errors = []; _.each(frame.data.settings, (setting) => { - if (setting.key === 'ghost_head' || setting.key === 'ghost_foot') { - // @NOTE: was removed https://github.com/TryGhost/Ghost/issues/10373 - errors.push(new NotFoundError({ - message: tpl(messages.problemFindingSetting, { - key: setting.key - }) - })); - } - // TODO: the below array is INCOMPLETE // it should include all setting values that have array as a type const arrayTypeSettings = [ diff --git a/core/server/data/importer/importers/data/settings.js b/core/server/data/importer/importers/data/settings.js index fec866cd2c..aafbeb523a 100644 --- a/core/server/data/importer/importers/data/settings.js +++ b/core/server/data/importer/importers/data/settings.js @@ -15,9 +15,7 @@ const ignoredSettings = ['slack_url', 'members_from_address', 'members_support_a // NOTE: drop support in Ghost 5.0 const deprecatedSupportedSettingsMap = { default_locale: 'lang', - active_timezone: 'timezone', - ghost_head: 'codeinjection_head', - ghost_foot: 'codeinjection_foot' + active_timezone: 'timezone' }; const deprecatedSupportedSettingsOneToManyMap = { // NOTE: intentionally ignoring slack_url setting diff --git a/test/integration/importer/v2.test.js b/test/integration/importer/v2.test.js index 4a2eab0737..b6891f1a92 100644 --- a/test/integration/importer/v2.test.js +++ b/test/integration/importer/v2.test.js @@ -908,11 +908,6 @@ describe('Importer', function () { value: 'Pacific/Auckland' }); - exportData.data.settings[2] = testUtils.DataGenerator.forKnex.createSetting({ - key: 'ghost_foot', - value: 'AVADA KEDAVRA' - }); - return dataImporter.doImport(exportData, importOptions) .then(function (imported) { imported.problems.length.should.eql(0); @@ -926,12 +921,6 @@ describe('Importer', function () { }) .then(function (result) { result.attributes.value.should.eql('Pacific/Auckland'); - }) - .then(function () { - return models.Settings.findOne(_.merge({key: 'codeinjection_foot'}, testUtils.context.internal)); - }) - .then(function (result) { - result.attributes.value.should.eql('AVADA KEDAVRA'); }); });