0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merged v5.19.3 into main

v5.19.3
This commit is contained in:
Daniel Lockyer 2022-10-19 06:22:38 +07:00
commit 9b8c33484d
No known key found for this signature in database
4 changed files with 68 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "ghost-admin",
"version": "5.19.2",
"version": "5.19.3",
"description": "Ember.js admin client for Ghost",
"author": "Ghost Foundation",
"homepage": "http://ghost.org",

View file

@ -231,7 +231,7 @@ const PostEmailSerializer = {
titleAlignment: newsletter.get('title_alignment'),
bodyFontCategory: newsletter.get('body_font_category'),
showBadge: newsletter.get('show_badge'),
feedbackEnabled: newsletter.get('feedback_enabled'),
feedbackEnabled: newsletter.get('feedback_enabled') && labs.isSet('audienceFeedback'),
footerContent: newsletter.get('footer_content'),
showHeaderName: newsletter.get('show_header_name'),
accentColor,

View file

@ -1,6 +1,6 @@
{
"name": "ghost",
"version": "5.19.2",
"version": "5.19.3",
"description": "The professional publishing platform",
"author": "Ghost Foundation",
"homepage": "https://ghost.org",

View file

@ -385,7 +385,70 @@ describe('Post Email Serializer', function () {
assert(!output.html.includes('<!-- PAYWALL -->'));
});
it('should hide/show feedback buttons depending on feedback_enabled flag', async function () {
it('should hide feedback buttons and ignore feedback_enabled if alpha flag disabled', async function () {
sinon.stub(labs, 'isSet').returns(false);
sinon.stub(_PostEmailSerializer, 'serializePostModel').callsFake(async () => {
return {
url: 'https://testpost.com/',
title: 'This is a test',
excerpt: 'This is a test',
authors: 'This is a test',
feature_image_alt: 'This is a test',
feature_image_caption: 'This is a test',
// eslint-disable-next-line
mobiledoc: JSON.stringify({"version":"0.3.1","atoms":[],"cards":[],"markups":[],"sections":[[1,"p",[[0,[],0,"Free content only"]]]],"ghostVersion":"4.0"})
};
});
const customSettings = {
accent_color: '#000099',
timezone: 'UTC'
};
const settingsMock = sinon.stub(settingsCache, 'get');
settingsMock.callsFake(function (key, options) {
if (customSettings[key]) {
return customSettings[key];
}
return settingsMock.wrappedMethod.call(settingsCache, key, options);
});
const template = {
name: 'My newsletter',
header_image: '',
show_header_icon: true,
show_header_title: true,
show_feature_image: true,
title_font_category: 'sans-serif',
title_alignment: 'center',
body_font_category: 'serif',
show_badge: true,
show_header_name: true,
feedback_enabled: true,
footer_content: 'footer'
};
const newsletterMock = {
get: function (key) {
return template[key];
},
toJSON: function () {
return template;
}
};
const output = await serialize({}, newsletterMock, {isBrowserPreview: false});
assert(!output.html.includes('%{feedback_button_like}%'));
assert(!output.html.includes('%{feedback_button_dislike}%'));
template.feedback_enabled = true;
const outputWithButtons = await serialize({}, newsletterMock, {isBrowserPreview: false});
assert(!outputWithButtons.html.includes('%{feedback_button_like}%'));
assert(!outputWithButtons.html.includes('%{feedback_button_dislike}%'));
});
/*it('should hide/show feedback buttons depending on feedback_enabled flag', async function () {
sinon.stub(labs, 'isSet').returns(true);
sinon.stub(_PostEmailSerializer, 'serializePostModel').callsFake(async () => {
return {
url: 'https://testpost.com/',
@ -444,7 +507,7 @@ describe('Post Email Serializer', function () {
const outputWithButtons = await serialize({}, newsletterMock, {isBrowserPreview: false});
assert(outputWithButtons.html.includes('%{feedback_button_like}%'));
assert(outputWithButtons.html.includes('%{feedback_button_dislike}%'));
});
});*/
});
describe('renderEmailForSegment', function () {