0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added version_notifications key to settings table

refs https://github.com/TryGhost/Toolbox/issues/292

- When version missmatch handling is done in Ghost we need to store the 'Accept-Version' header values that have been already processed in the past (to avoid sending notifications about the same mismatch multiple times)
- The `version_notifications` will be storing an array with handled versions like so: `['v3.44', 'v4.23', 'v4.39']`.
- The emailing logic and processing is slightly similar to how "notification" key is handled, that's why I've placed the definition of this new key close by.
This commit is contained in:
Naz 2022-04-21 10:48:21 +08:00 committed by naz
parent b9646cceb1
commit 1ecb837981
7 changed files with 21 additions and 4 deletions

View file

@ -0,0 +1,8 @@
const {addSetting} = require('../../utils.js');
module.exports = addSetting({
key: 'version_notifications',
value: '[]',
type: 'array',
group: 'core'
});

View file

@ -16,6 +16,10 @@
"defaultValue": "[]",
"type": "array"
},
"version_notifications": {
"defaultValue": "[]",
"type": "array"
},
"session_secret": {
"defaultValue": null,
"type": "string"

View file

@ -19,6 +19,7 @@ describe('Settings', function () {
'routes_hash',
'next_update_check',
'notifications',
'version_notifications',
'session_secret',
'theme_session_secret',
'ghost_public_key',

View file

@ -17,7 +17,7 @@ describe('Settings Model', function () {
await models.Settings.populateDefaults();
const settingsPopulated = await models.Settings.findAll();
settingsPopulated.length.should.equal(95);
settingsPopulated.length.should.equal(96);
});
it('doesn\'t overwrite any existing settings', async function () {
@ -42,7 +42,7 @@ describe('Settings Model', function () {
await models.Settings.populateDefaults();
const settingsPopulated = await models.Settings.findAll();
settingsPopulated.length.should.equal(95);
settingsPopulated.length.should.equal(96);
const titleSetting = settingsPopulated.models.find(s => s.get('key') === 'title');
titleSetting.get('value').should.equal('Testing Defaults');

View file

@ -198,7 +198,7 @@ describe('Exporter', function () {
// NOTE: if default settings changed either modify the settings keys blocklist or increase allowedKeysLength
// This is a reminder to think about the importer/exporter scenarios ;)
const allowedKeysLength = 85;
const allowedKeysLength = 86;
totalKeysLength.should.eql(SETTING_KEYS_BLOCKLIST.length + allowedKeysLength);
});
});

View file

@ -37,7 +37,7 @@ describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = 'ae71340a8c89f6580b2eb06101f003b4';
const currentFixturesHash = '2fe576bcde3428c3063c05b2f2c37367';
const currentSettingsHash = '71fa38d0c805c18ceebe0fda80886230';
const currentSettingsHash = 'ffd899a82b0ad2886e92d8244bcbca6a';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
// If this test is failing, then it is likely a change has been made that requires a DB version bump,

View file

@ -16,6 +16,10 @@
"defaultValue": "[]",
"type": "array"
},
"version_notifications": {
"defaultValue": "[]",
"type": "array"
},
"session_secret": {
"defaultValue": null,
"type": "string"