2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Added new brand blog setting (#11408)

no issue

Adds new `brand: {primary_color: ''}` blog setting behind dev flag for setting user-defined brand color in themes and emails.
This commit is contained in:
Rishabh Garg 2019-12-17 16:15:31 +05:30 committed by GitHub
parent 7bf48e49a1
commit fa3686bcc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View file

@ -6,6 +6,7 @@ const gating = require('./post-gating');
const clean = require('./clean');
const extraAttrs = require('./extra-attrs');
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
const config = require('../../../../../../config');
const mapUser = (model, frame) => {
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
@ -99,11 +100,17 @@ const mapSettings = (attrs, frame) => {
// fields completely.
if (_.isArray(attrs)) {
attrs = _.filter(attrs, (o) => {
if (o.key === 'brand' && !config.get('enableDeveloperExperiments')) {
return false;
}
return o.key !== 'ghost_head' && o.key !== 'ghost_foot';
});
} else {
delete attrs.ghost_head;
delete attrs.ghost_foot;
if (!config.get('enableDeveloperExperiments')) {
delete attrs.brand;
}
}
return attrs;

View file

@ -42,6 +42,9 @@
"icon": {
"defaultValue": ""
},
"brand": {
"defaultValue": "{\"primaryColor\":\"\"}"
},
"default_locale": {
"defaultValue": "en",
"validations": {

View file

@ -11,6 +11,7 @@ module.exports = {
description: 'description',
logo: 'logo',
icon: 'icon',
brand: 'brand',
cover_image: 'cover_image',
facebook: 'facebook',
twitter: 'twitter',

View file

@ -43,7 +43,7 @@ describe('Settings Content API', function () {
// Verify we have the right keys for settings
const publicProperties = _.filter(_.values(publicSettings), (o) => {
return (o !== 'ghost_head' && o !== 'ghost_foot');
return (o !== 'ghost_head' && o !== 'ghost_foot' && o !== 'brand');
});
publicProperties.push('codeinjection_head', 'codeinjection_foot');
settings.should.have.properties(publicProperties);