Added default_content_visibility_tiers setting for default tiers visibility

refs https://github.com/TryGhost/Team/issues/1071

Default content visibility for a post can be one of `public|members|paid|tiers`, where `tiers` denotes visibility restricted to specific tiers. This change adds a new setting to store the tier ids when default content visibility is set to `tiers`. This closely matches how the visibility is stored on `posts` table as well, with `visibility` stored as `tiers` and tiers data is stored on tiers pivot table.
This commit is contained in:
Rishabh 2022-02-03 14:37:27 +05:30 committed by Rishabh Garg
parent d41e980dba
commit 6f89ccf901
5 changed files with 19 additions and 2 deletions

View File

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

View File

@ -235,6 +235,10 @@
"defaultValue": "public",
"type": "string"
},
"default_content_visibility_tiers": {
"defaultValue": "[]",
"type": "array"
},
"members_signup_access": {
"defaultValue": "all",
"validations": {

View File

@ -144,6 +144,11 @@ const defaultSettingsKeyTypes = [
type: 'string',
group: 'members'
},
{
key: 'default_content_visibility_tiers',
type: 'array',
group: 'members'
},
{
key: 'members_signup_access',
type: 'string',

View File

@ -199,7 +199,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);
});
});

View File

@ -37,7 +37,7 @@ describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '9e4eeb5c260047fe21d1f93c523bd771';
const currentFixturesHash = 'beb040c0376a492c2a44767fdd825a3e';
const currentSettingsHash = 'd73b63e33153c9256bca42ebfd376779';
const currentSettingsHash = '437d4c6da8759f5c35f11f811b86e5bc';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
// If this test is failing, then it is likely a change has been made that requires a DB version bump,