A platform for community discussion. Free, open, simple.
FIX: Email Styles were evaluated out of order
Robin Wardfd2d7ca9928c
diff --git a/app/helpers/email_helper.rb b/app/helpers/email_helper.rbindex 14364d45c32..a1373329b8e 100644--- a/app/helpers/email_helper.rb+++ b/app/helpers/email_helper.rb@@ -26,7 +26,7 @@ module EmailHelperenddef email_html_template- EmailStyle.new.html.sub('%{email_content}', yield).html_safe+ EmailStyle.new.html.sub('%{email_content}', capture { yield }).html_safeendprotecteddiff --git a/spec/integration/email_style_spec.rb b/spec/integration/email_style_spec.rbindex 395dd19df15..42203ecdfe2 100644--- a/spec/integration/email_style_spec.rb+++ b/spec/integration/email_style_spec.rb@@ -6,9 +6,10 @@ describe EmailStyle docontext "ERB evaluation" doit "does not evaluate ERB outside of the email itself" do- SiteSetting.email_custom_template = "<div>%{email_content}</div><%= (111 * 333) %>"+ SiteSetting.email_custom_template = "<hello>%{email_content}</hello><%= (111 * 333) %>"html = Email::Renderer.new(UserNotifications.signup(Fabricate(:user))).htmlexpect(html).not_to match("36963")+ expect(html.starts_with?('<hello>')).to eq(true)endend