mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 04:13:30 +03:00
Exposed comments_enabled setting publicly
refs https://github.com/TryGhost/Team/issues/1664 This also means that themes have access to this setting
This commit is contained in:
parent
41a8134c40
commit
6a8c6e9081
@ -36,7 +36,11 @@ async function updateGlobalTemplateOptions(req, res, next) {
|
|||||||
{
|
{
|
||||||
hbs.updateTemplateOptions({
|
hbs.updateTemplateOptions({
|
||||||
data: {
|
data: {
|
||||||
site: siteData,
|
site: {
|
||||||
|
...siteData,
|
||||||
|
comments_enabled: siteData.comments_enabled !== 'off',
|
||||||
|
comments_access: siteData.comments_enabled
|
||||||
|
},
|
||||||
labs: labsData,
|
labs: labsData,
|
||||||
config: themeData,
|
config: themeData,
|
||||||
custom: themeSettingsData
|
custom: themeSettingsData
|
||||||
|
@ -36,5 +36,6 @@ module.exports = {
|
|||||||
portal_button_icon: 'portal_button_icon',
|
portal_button_icon: 'portal_button_icon',
|
||||||
portal_plans: 'portal_plans',
|
portal_plans: 'portal_plans',
|
||||||
portal_name: 'portal_name',
|
portal_name: 'portal_name',
|
||||||
portal_button: 'portal_button'
|
portal_button: 'portal_button',
|
||||||
|
comments_enabled: 'comments_enabled'
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ Object {
|
|||||||
"accent_color": "#FF1A75",
|
"accent_color": "#FF1A75",
|
||||||
"codeinjection_foot": null,
|
"codeinjection_foot": null,
|
||||||
"codeinjection_head": null,
|
"codeinjection_head": null,
|
||||||
|
"comments_enabled": null,
|
||||||
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
||||||
"description": "Thoughts, stories and ideas",
|
"description": "Thoughts, stories and ideas",
|
||||||
"facebook": "ghost",
|
"facebook": "ghost",
|
||||||
|
@ -485,6 +485,7 @@ Object {
|
|||||||
"accent_color": "#FF1A75",
|
"accent_color": "#FF1A75",
|
||||||
"codeinjection_foot": null,
|
"codeinjection_foot": null,
|
||||||
"codeinjection_head": null,
|
"codeinjection_head": null,
|
||||||
|
"comments_enabled": null,
|
||||||
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
||||||
"description": "Thoughts, stories and ideas",
|
"description": "Thoughts, stories and ideas",
|
||||||
"facebook": "ghost",
|
"facebook": "ghost",
|
||||||
@ -578,6 +579,7 @@ Object {
|
|||||||
"accent_color": "#FF1A75",
|
"accent_color": "#FF1A75",
|
||||||
"codeinjection_foot": null,
|
"codeinjection_foot": null,
|
||||||
"codeinjection_head": null,
|
"codeinjection_head": null,
|
||||||
|
"comments_enabled": null,
|
||||||
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
"cover_image": "https://static.ghost.org/v4.0.0/images/publication-cover.jpg",
|
||||||
"description": "Thoughts, stories and ideas",
|
"description": "Thoughts, stories and ideas",
|
||||||
"facebook": "ghost",
|
"facebook": "ghost",
|
||||||
|
@ -49,7 +49,9 @@ describe('Themes middleware', function () {
|
|||||||
|
|
||||||
fakeActiveThemeName = 'bacon-sensation';
|
fakeActiveThemeName = 'bacon-sensation';
|
||||||
|
|
||||||
fakeSiteData = {};
|
fakeSiteData = {
|
||||||
|
comments_enabled: 'all'
|
||||||
|
};
|
||||||
|
|
||||||
fakeLabsData = {
|
fakeLabsData = {
|
||||||
// labs data is deep cloned,
|
// labs data is deep cloned,
|
||||||
@ -159,9 +161,16 @@ describe('Themes middleware', function () {
|
|||||||
// Check labs config
|
// Check labs config
|
||||||
should.deepEqual(data.labs, fakeLabsData);
|
should.deepEqual(data.labs, fakeLabsData);
|
||||||
|
|
||||||
should.equal(data.site, fakeSiteData);
|
should.deepEqual(data.site, {
|
||||||
should.exist(data.site.signup_url);
|
...fakeSiteData,
|
||||||
data.site.signup_url.should.equal('#/portal');
|
|
||||||
|
// signup_url should get added
|
||||||
|
signup_url: '#/portal',
|
||||||
|
|
||||||
|
// the comments_enabled setting should be mapped to comments_access, and comments_enabled should be a boolean
|
||||||
|
comments_enabled: true,
|
||||||
|
comments_access: 'all'
|
||||||
|
});
|
||||||
|
|
||||||
should.deepEqual(data.custom, fakeCustomThemeSettingsData);
|
should.deepEqual(data.custom, fakeCustomThemeSettingsData);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user