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

Improve visibility's default handling (#11183)

no issue

- Moved default_content_visibility out of labs as we should be extra careful with what is exposed in the labs + it doesn't really belong there.
This commit is contained in:
Naz Gargol 2019-10-02 11:08:10 +02:00 committed by GitHub
parent a3f3a56589
commit e214838039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View file

@ -194,6 +194,9 @@
"members_session_secret": {
"defaultValue": null
},
"default_content_visibility": {
"defaultValue": "public"
},
"members_subscription_settings": {
"defaultValue": "{\"isPaid\":false,\"paymentProcessors\":[{\"adapter\":\"stripe\",\"config\":{\"secret_token\":\"\",\"public_token\":\"\",\"product\":{\"name\":\"Ghost Subscription\"},\"plans\":[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":\"\"},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":\"\"}]}}]}"
}

View file

@ -43,8 +43,8 @@ Post = ghostBookshelf.Model.extend({
defaults: function defaults() {
let visibility = 'public';
if (settingsCache.get('labs') && (settingsCache.get('labs').members === true) && settingsCache.get('labs').default_content_visibility) {
visibility = settingsCache.get('labs').default_content_visibility;
if (settingsCache.get('labs') && (settingsCache.get('labs').members === true) && settingsCache.get('default_content_visibility')) {
visibility = settingsCache.get('default_content_visibility');
}
return {

View file

@ -113,7 +113,7 @@ describe('Unit: models/settings', function () {
return models.Settings.populateDefaults()
.then(() => {
eventSpy.callCount.should.equal(78);
eventSpy.callCount.should.equal(80);
eventSpy.args[1][0].should.equal('settings.db_hash.added');
eventSpy.args[1][1].attributes.type.should.equal('core');
@ -122,7 +122,8 @@ describe('Unit: models/settings', function () {
eventSpy.args[13][1].attributes.type.should.equal('blog');
eventSpy.args[13][1].attributes.value.should.equal('The professional publishing platform');
eventSpy.args[77][0].should.equal('settings.members_subscription_settings.added');
eventSpy.args[77][0].should.equal('settings.default_content_visibility.added');
eventSpy.args[79][0].should.equal('settings.members_subscription_settings.added');
});
});
@ -136,7 +137,7 @@ describe('Unit: models/settings', function () {
return models.Settings.populateDefaults()
.then(() => {
eventSpy.callCount.should.equal(76);
eventSpy.callCount.should.equal(78);
eventSpy.args[13][0].should.equal('settings.logo.added');
});