diff --git a/ghost/email-service/lib/email-renderer.js b/ghost/email-service/lib/email-renderer.js index 64ec24cc1e..7e98784350 100644 --- a/ghost/email-service/lib/email-renderer.js +++ b/ghost/email-service/lib/email-renderer.js @@ -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; diff --git a/ghost/email-service/test/email-renderer.test.js b/ghost/email-service/test/email-renderer.test.js index e13b4c5e6b..7bd0f74494 100644 --- a/ghost/email-service/test/email-renderer.test.js +++ b/ghost/email-service/test/email-renderer.test.js @@ -260,12 +260,14 @@ describe('Email renderer', function () { return '
Mobiledoc Test
'; } } + }, + 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 'Lexical Test members only section
'; } } + }, + 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 '