0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

Added subscription details to newsletters

fixes https://github.com/TryGhost/Team/issues/2674

Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
This commit is contained in:
Simon Backx 2023-03-24 10:31:48 +01:00 committed by Simon Backx
parent 104a81d8c3
commit 07b6cda3db
2 changed files with 1 additions and 37 deletions

View file

@ -834,7 +834,7 @@ class EmailRenderer {
name: newsletter.get('name'),
showPostTitleSection: newsletter.get('show_post_title_section'),
showCommentCta: newsletter.get('show_comment_cta') && this.#settingsCache.get('comments_enabled') !== 'off' && !hasEmailOnlyFlag,
showSubscriptionDetails: newsletter.get('show_subscription_details') && this.#labs.isSet('makingItRain')
showSubscriptionDetails: newsletter.get('show_subscription_details')
},
latestPosts,
latestPostsHasImages,

View file

@ -1587,24 +1587,6 @@ describe('Email renderer', function () {
assert.equal(data.newsletter.showCommentCta, true);
});
it('showSubscriptionDetails is disabled if labs disabled', async function () {
labsEnabled = false;
const html = '';
const post = createModel({
posts_meta: createModel({}),
loaded: ['posts_meta'],
published_at: new Date(0)
});
const newsletter = createModel({
title_font_category: 'serif',
title_alignment: 'left',
body_font_category: 'sans_serif',
show_subscription_details: true
});
const data = await emailRenderer.getTemplateData({post, newsletter, html, addPaywall: false});
assert.equal(data.newsletter.showSubscriptionDetails, false);
});
it('showSubscriptionDetails works is enabled', async function () {
labsEnabled = true;
const html = '';
@ -1659,24 +1641,6 @@ describe('Email renderer', function () {
assert.deepEqual(data.latestPosts, []);
});
it('latestPosts can be disabled via labs', async function () {
labsEnabled = false;
const html = '';
const post = createModel({
posts_meta: createModel({}),
loaded: ['posts_meta'],
published_at: new Date(0)
});
const newsletter = createModel({
title_font_category: 'serif',
title_alignment: 'left',
body_font_category: 'sans_serif',
show_latest_posts: true
});
const data = await emailRenderer.getTemplateData({post, newsletter, html, addPaywall: false});
assert.deepEqual(data.latestPosts, []);
});
it('latestPosts can be enabled', async function () {
labsEnabled = true;
const html = '';