mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
🐛 Fixed link to posts on audio cards in emails
refs https://ghost.slack.com/archives/CTH5NDJMS/p1675356984043299 The url property doesn't exists on post, this was copied from the old MEGA flow that serialized the model first.
This commit is contained in:
parent
509affb1f7
commit
0f08f39a1b
@ -176,14 +176,15 @@ class EmailRenderer {
|
||||
}
|
||||
|
||||
renderPostBaseHtml(post) {
|
||||
const postUrl = this.#getPostUrl(post);
|
||||
let html;
|
||||
if (post.get('lexical')) {
|
||||
html = this.#renderers.lexical.render(
|
||||
post.get('lexical'), {target: 'email', postUrl: post.url}
|
||||
post.get('lexical'), {target: 'email', postUrl}
|
||||
);
|
||||
} else {
|
||||
html = this.#renderers.mobiledoc.render(
|
||||
JSON.parse(post.get('mobiledoc')), {target: 'email', postUrl: post.url}
|
||||
JSON.parse(post.get('mobiledoc')), {target: 'email', postUrl}
|
||||
);
|
||||
}
|
||||
return html;
|
||||
|
@ -260,12 +260,14 @@ describe('Email renderer', function () {
|
||||
return '<p> Mobiledoc Test</p>';
|
||||
}
|
||||
}
|
||||
},
|
||||
getPostUrl: () => {
|
||||
return 'http://example.com/post-id';
|
||||
}
|
||||
});
|
||||
|
||||
it('returns correct empty segment for post', function () {
|
||||
let post = {
|
||||
url: '',
|
||||
get: (key) => {
|
||||
if (key === 'lexical') {
|
||||
return '{}';
|
||||
@ -276,7 +278,6 @@ describe('Email renderer', function () {
|
||||
response.should.eql([null]);
|
||||
|
||||
post = {
|
||||
url: '',
|
||||
get: (key) => {
|
||||
if (key === 'mobiledoc') {
|
||||
return '{}';
|
||||
@ -295,11 +296,13 @@ describe('Email renderer', function () {
|
||||
return '<p> Lexical Test <!--members-only--> members only section</p>';
|
||||
}
|
||||
}
|
||||
},
|
||||
getPostUrl: () => {
|
||||
return 'http://example.com/post-id';
|
||||
}
|
||||
});
|
||||
|
||||
let post = {
|
||||
url: '',
|
||||
get: (key) => {
|
||||
if (key === 'lexical') {
|
||||
return '{}';
|
||||
@ -318,11 +321,13 @@ describe('Email renderer', function () {
|
||||
return '<html> <div> Lexical Test </div> <div data-gh-segment="status:-free"> members only section</div> </html>';
|
||||
}
|
||||
}
|
||||
},
|
||||
getPostUrl: () => {
|
||||
return 'http://example.com/post-id';
|
||||
}
|
||||
});
|
||||
|
||||
let post = {
|
||||
url: '',
|
||||
get: (key) => {
|
||||
if (key === 'lexical') {
|
||||
return '{}';
|
||||
@ -407,7 +412,6 @@ describe('Email renderer', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
basePost = {
|
||||
url: '',
|
||||
lexical: '{}',
|
||||
visibility: 'public',
|
||||
title: 'Test Post',
|
||||
@ -693,7 +697,6 @@ describe('Email renderer', function () {
|
||||
it('removes data-gh-segment and renders paywall', async function () {
|
||||
renderedPost = '<div> Lexical Test </div> <div data-gh-segment="status:-free"> members only section</div> some text for both <!--members-only--> finishing part only for members';
|
||||
let post = {
|
||||
url: '',
|
||||
related: () => {
|
||||
return null;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user