mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Added migrations for Tips & Donations' settings (#17576)
closes https://github.com/TryGhost/Product/issues/3668 - Tips and Donations feature offers two settings: "donations_currency", and "donations_suggested_amount" - "donation_currency": the currency to be used for the donation. Defaults to "USD", not nullable. - "donation_suggested_amount": an anchor price for the donation. Defaults to 0, not nullable. - Both settings belong to a new group "donations" Tech Spec: https://www.notion.so/ghost/Tech-Spec-5cd6929f7960462ebcbf198176e0d899?pvs=4#6e8b34c45f0c4c78b48c9e7725a307c8
This commit is contained in:
parent
c06ba9bec9
commit
19bdb0efef
@ -0,0 +1,16 @@
|
||||
const {combineTransactionalMigrations, addSetting} = require('../../utils');
|
||||
|
||||
module.exports = combineTransactionalMigrations(
|
||||
addSetting({
|
||||
key: 'donations_currency',
|
||||
value: 'USD',
|
||||
type: 'string',
|
||||
group: 'donations'
|
||||
}),
|
||||
addSetting({
|
||||
key: 'donations_suggested_amount',
|
||||
value: 0,
|
||||
type: 'number',
|
||||
group: 'donations'
|
||||
})
|
||||
);
|
@ -549,5 +549,21 @@
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"donations": {
|
||||
"donations_currency": {
|
||||
"defaultValue": "USD",
|
||||
"validations": {
|
||||
"isEmpty": false
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"donations_suggested_amount": {
|
||||
"defaultValue": 0,
|
||||
"validations": {
|
||||
"isEmpty": false
|
||||
},
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +304,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -694,6 +702,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -718,7 +734,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": "4012",
|
||||
"content-length": "4104",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
@ -1032,6 +1048,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -1369,6 +1393,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -1711,6 +1743,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -2141,6 +2181,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -2543,6 +2591,14 @@ Object {
|
||||
"key": "pintura_css_url",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "donations_currency",
|
||||
"value": "USD",
|
||||
},
|
||||
Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
|
@ -8,7 +8,7 @@ const {stringMatching, anyEtag, anyUuid, anyContentLength, anyContentVersion} =
|
||||
const models = require('../../../core/server/models');
|
||||
const {anyErrorId} = matchers;
|
||||
|
||||
const CURRENT_SETTINGS_COUNT = 79;
|
||||
const CURRENT_SETTINGS_COUNT = 81;
|
||||
|
||||
const settingsMatcher = {};
|
||||
|
||||
|
@ -5,7 +5,7 @@ const db = require('../../../core/server/data/db');
|
||||
// Stuff we are testing
|
||||
const models = require('../../../core/server/models');
|
||||
|
||||
const SETTINGS_LENGTH = 90;
|
||||
const SETTINGS_LENGTH = 92;
|
||||
|
||||
describe('Settings Model', function () {
|
||||
before(models.init);
|
||||
|
@ -236,7 +236,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 = 82;
|
||||
const allowedKeysLength = 84;
|
||||
totalKeysLength.should.eql(SETTING_KEYS_BLOCKLIST.length + allowedKeysLength);
|
||||
});
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = '99a8fe2394b685cc1ce4c44d8e87a1ad';
|
||||
const currentFixturesHash = 'af43eef1ac4f14fc1bc0ea351300420f';
|
||||
const currentSettingsHash = '4f23a583335dcb4cb3fae553122ea200';
|
||||
const currentSettingsHash = 'dd0e318627ded65e41f188fb5bdf5b74';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
@ -557,5 +557,21 @@
|
||||
"defaultValue": null,
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"donations": {
|
||||
"donations_currency": {
|
||||
"defaultValue": "USD",
|
||||
"validations": {
|
||||
"isEmpty": false
|
||||
},
|
||||
"type": "string"
|
||||
},
|
||||
"donations_suggested_amount": {
|
||||
"defaultValue": 0,
|
||||
"validations": {
|
||||
"isEmpty": false
|
||||
},
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user