mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Added new setting to enable Recommendations (#17856)
closes https://github.com/TryGhost/Product/issues/3772 - Recommendations are disabled by default and will get enabled when a first recommendation is added. The "recommendations_enabled" setting will be not shown explicitly in Admin, it will rather be set implicitly based on whether there is at least one recommendation - The "recommendations_enabled" setting belongs to a new setting group called "recommendations" Tech Spec: https://www.notion.so/ghost/Recommentions-Tech-Spec-598f09e4109f4eef8d9e32db7245a90c?pvs=4
This commit is contained in:
parent
89e9e4a2b8
commit
f1cd6432a8
@ -70,7 +70,8 @@ const EDITABLE_SETTINGS = [
|
||||
'pintura_js_url',
|
||||
'pintura_css_url',
|
||||
'donations_currency',
|
||||
'donations_suggested_amount'
|
||||
'donations_suggested_amount',
|
||||
'recommendations_enabled'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
|
@ -0,0 +1,8 @@
|
||||
const {addSetting} = require('../../utils');
|
||||
|
||||
module.exports = addSetting({
|
||||
key: 'recommendations_enabled',
|
||||
value: 'false',
|
||||
type: 'boolean',
|
||||
group: 'recommendations'
|
||||
});
|
@ -565,5 +565,15 @@
|
||||
},
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"recommendations": {
|
||||
"recommendations_enabled": {
|
||||
"defaultValue": "false",
|
||||
"validations": {
|
||||
"isEmpty": false,
|
||||
"isIn": [["true", "false"]]
|
||||
},
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,5 +39,6 @@ module.exports = {
|
||||
portal_plans: 'portal_plans',
|
||||
portal_name: 'portal_name',
|
||||
portal_button: 'portal_button',
|
||||
comments_enabled: 'comments_enabled'
|
||||
comments_enabled: 'comments_enabled',
|
||||
recommendations_enabled: 'recommendations_enabled'
|
||||
};
|
||||
|
@ -312,6 +312,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -714,6 +718,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -742,7 +750,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": "4145",
|
||||
"content-length": "4193",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
@ -1064,6 +1072,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -1413,6 +1425,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -1767,6 +1783,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -2209,6 +2229,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
Object {
|
||||
"key": "members_enabled",
|
||||
"value": true,
|
||||
@ -2623,6 +2647,10 @@ Object {
|
||||
"key": "donations_suggested_amount",
|
||||
"value": "0",
|
||||
},
|
||||
Object {
|
||||
"key": "recommendations_enabled",
|
||||
"value": false,
|
||||
},
|
||||
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 = 82;
|
||||
const CURRENT_SETTINGS_COUNT = 83;
|
||||
|
||||
const settingsMatcher = {};
|
||||
|
||||
|
@ -57,6 +57,7 @@ Object {
|
||||
],
|
||||
"portal_signup_checkbox_required": false,
|
||||
"portal_signup_terms_html": null,
|
||||
"recommendations_enabled": false,
|
||||
"secondary_navigation": Array [
|
||||
Object {
|
||||
"label": "Data & privacy",
|
||||
|
@ -1391,6 +1391,7 @@ Object {
|
||||
],
|
||||
"portal_signup_checkbox_required": false,
|
||||
"portal_signup_terms_html": null,
|
||||
"recommendations_enabled": false,
|
||||
"secondary_navigation": Array [
|
||||
Object {
|
||||
"label": "Data & privacy",
|
||||
@ -1487,6 +1488,7 @@ Object {
|
||||
],
|
||||
"portal_signup_checkbox_required": false,
|
||||
"portal_signup_terms_html": null,
|
||||
"recommendations_enabled": false,
|
||||
"secondary_navigation": Array [
|
||||
Object {
|
||||
"label": "Data & privacy",
|
||||
|
@ -5,7 +5,7 @@ const db = require('../../../core/server/data/db');
|
||||
// Stuff we are testing
|
||||
const models = require('../../../core/server/models');
|
||||
|
||||
const SETTINGS_LENGTH = 92;
|
||||
const SETTINGS_LENGTH = 93;
|
||||
|
||||
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 = 84;
|
||||
const allowedKeysLength = 85;
|
||||
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 = '5674764ca6518961a9b2917e7d8e2ea9';
|
||||
const currentFixturesHash = '31865c37aacfec9b8f16c1354b36a7de';
|
||||
const currentSettingsHash = 'dd0e318627ded65e41f188fb5bdf5b74';
|
||||
const currentSettingsHash = '3a7ca0aa6a06cba47e3e898aef7029c2';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
||||
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
|
||||
|
@ -540,5 +540,15 @@
|
||||
},
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"recommendations": {
|
||||
"recommendations_enabled": {
|
||||
"defaultValue": "false",
|
||||
"validations": {
|
||||
"isEmpty": false,
|
||||
"isIn": [["true", "false"]]
|
||||
},
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -573,5 +573,15 @@
|
||||
},
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"recommendations": {
|
||||
"recommendations_enabled": {
|
||||
"defaultValue": "false",
|
||||
"validations": {
|
||||
"isEmpty": false,
|
||||
"isIn": [["true", "false"]]
|
||||
},
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user