mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -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:
parent
104a81d8c3
commit
07b6cda3db
2 changed files with 1 additions and 37 deletions
|
@ -834,7 +834,7 @@ class EmailRenderer {
|
||||||
name: newsletter.get('name'),
|
name: newsletter.get('name'),
|
||||||
showPostTitleSection: newsletter.get('show_post_title_section'),
|
showPostTitleSection: newsletter.get('show_post_title_section'),
|
||||||
showCommentCta: newsletter.get('show_comment_cta') && this.#settingsCache.get('comments_enabled') !== 'off' && !hasEmailOnlyFlag,
|
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,
|
latestPosts,
|
||||||
latestPostsHasImages,
|
latestPostsHasImages,
|
||||||
|
|
|
@ -1587,24 +1587,6 @@ describe('Email renderer', function () {
|
||||||
assert.equal(data.newsletter.showCommentCta, true);
|
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 () {
|
it('showSubscriptionDetails works is enabled', async function () {
|
||||||
labsEnabled = true;
|
labsEnabled = true;
|
||||||
const html = '';
|
const html = '';
|
||||||
|
@ -1659,24 +1641,6 @@ describe('Email renderer', function () {
|
||||||
assert.deepEqual(data.latestPosts, []);
|
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 () {
|
it('latestPosts can be enabled', async function () {
|
||||||
labsEnabled = true;
|
labsEnabled = true;
|
||||||
const html = '';
|
const html = '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue