FIX: backwards compatibility for uncompiled email style css

This commit is contained in:
Neil Lalonde 2019-10-23 19:21:24 -04:00
parent 40254bae1b
commit cfe26eb301
2 changed files with 7 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class EmailStyle
end
def compiled_css
SiteSetting.email_custom_css_compiled || self.class.default_css_compiled
SiteSetting.email_custom_css_compiled.presence || css
end
def default_html
@ -38,8 +38,4 @@ class EmailStyle
def self.default_css
''
end
def self.default_css_compiled
''
end
end

View File

@ -25,6 +25,12 @@ describe EmailStyle do
expect(mail_html).to match("#{Discourse.base_url}/invites/#{invite.invite_key}")
end
it 'applies customizations if compiled is missing' do
SiteSetting.remove_override!(:email_custom_css_compiled)
expect(mail_html.scan('<h1 style="color: red;">FOR YOU</h1>').count).to eq(1)
expect(mail_html).to match("#{Discourse.base_url}/invites/#{invite.invite_key}")
end
it 'can apply RTL attrs' do
SiteSetting.default_locale = 'he'
body_attrs = mail_html.match(/<body ([^>])+/)