Prevent premailer from converting HTML entities
This prevents `&mdash` in our templates being change to `-`
This commit is contained in:
parent
bc696947fd
commit
473674a2c3
3 changed files with 20 additions and 1 deletions
5
changelogs/unreleased/55964-fix-email-encoding.yml
Normal file
5
changelogs/unreleased/55964-fix-email-encoding.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix notfication emails having wrong encoding
|
||||||
|
merge_request: 26931
|
||||||
|
author:
|
||||||
|
type: fixed
|
|
@ -4,5 +4,6 @@ Premailer::Rails.config.merge!(
|
||||||
preserve_styles: true,
|
preserve_styles: true,
|
||||||
remove_comments: true,
|
remove_comments: true,
|
||||||
remove_ids: false,
|
remove_ids: false,
|
||||||
remove_scripts: false
|
remove_scripts: false,
|
||||||
|
output_encoding: 'US-ASCII'
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,6 +30,19 @@ describe Notify do
|
||||||
description: 'My awesome description!')
|
description: 'My awesome description!')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'with HTML-encoded entities' do
|
||||||
|
before do
|
||||||
|
described_class.test_email('test@test.com', 'Subject', 'Some body with —').deliver
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { ActionMailer::Base.deliveries.last }
|
||||||
|
|
||||||
|
it 'retains 7bit encoding' do
|
||||||
|
expect(subject.body.ascii_only?).to eq(true)
|
||||||
|
expect(subject.body.encoding).to eq('7bit')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'for a project' do
|
context 'for a project' do
|
||||||
shared_examples 'an assignee email' do
|
shared_examples 'an assignee email' do
|
||||||
it 'is sent to the assignee as the author' do
|
it 'is sent to the assignee as the author' do
|
||||||
|
|
Loading…
Reference in a new issue