mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
🐛 Fixed apostrophes not displaying correctly in Outlook for member emails
refs https://github.com/TryGhost/Ghost/issues/11536 - Outlook supports `'` as a special char for apostrophes but not `&#apos;` which is what cheerio/juiced render - adds a basic string placement to the email serializer to switch to the older style of special char
This commit is contained in:
parent
87965818db
commit
163092f377
@ -131,6 +131,9 @@ const serialize = async (postModel, options = {isBrowserPreview: false}) => {
|
||||
_cheerio('a').attr('target','_blank');
|
||||
juicedHtml = _cheerio.html();
|
||||
|
||||
// Fix any unsupported chars in Outlook
|
||||
juicedHtml = juicedHtml.replace(/'/g, ''');
|
||||
|
||||
const emailTmpl = {
|
||||
subject: post.email_subject || post.title,
|
||||
html: juicedHtml,
|
||||
|
@ -108,6 +108,38 @@ describe('Email Preview API', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('has custom content transformations for email compatibility', function () {
|
||||
const post = testUtils.DataGenerator.forKnex.createPost({
|
||||
id: ObjectId.generate(),
|
||||
title: 'Post with email-only card',
|
||||
slug: 'email-only-card',
|
||||
mobiledoc: '{"version":"0.3.1","atoms":[],"cards":[],"markups":[],"sections":[[1,"p",[[0,[],0,"This is the actual post content... With an apostrophy: \'"]]],[1,"p",[]]]}',
|
||||
html: '<p>This is the actual post content...</p>',
|
||||
plaintext: 'This is the actual post content...',
|
||||
status: 'draft',
|
||||
uuid: 'd52c42ae-2755-455c-80ec-70b2ec55c904'
|
||||
});
|
||||
|
||||
return models.Post.add(post, {context: {internal: true}}).then(() => {
|
||||
return request
|
||||
.get(localUtils.API.getApiQuery(`email_preview/posts/${post.id}/`))
|
||||
.set('Origin', config.get('url'))
|
||||
.set('Accept', 'application/json')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200)
|
||||
.then((res) => {
|
||||
should.not.exist(res.headers['x-cache-invalidate']);
|
||||
const jsonResponse = res.body;
|
||||
should.exist(jsonResponse);
|
||||
should.exist(jsonResponse.email_previews);
|
||||
|
||||
jsonResponse.email_previews[0].html.should.match(/'/);
|
||||
jsonResponse.email_previews[0].html.should.not.match(/'/);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('As Owner', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user