##// END OF EJS Templates
not add empty header/footer to notification emails (#13482)...
Toshi MARUYAMA -
r11491:19f70c95d1ae
parent child
Show More
@@ -25,9 +25,13 hr {
25 </style>
25 </style>
26 </head>
26 </head>
27 <body>
27 <body>
28 <% if Setting.emails_header.present? -%>
28 <span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header).html_safe %></span>
29 <span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header).html_safe %></span>
30 <% end -%>
29 <%= yield %>
31 <%= yield %>
30 <hr />
32 <hr />
33 <% if Setting.emails_footer.present? -%>
31 <span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer).html_safe %></span>
34 <span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer).html_safe %></span>
35 <% end -%>
32 </body>
36 </body>
33 </html>
37 </html>
@@ -1,4 +1,8
1 <% if Setting.emails_header.present? -%>
1 <%= Setting.emails_header %>
2 <%= Setting.emails_header %>
3 <% end -%>
2 <%= yield %>
4 <%= yield %>
5 <% if Setting.emails_footer.present? -%>
3 --
6 --
4 <%= Setting.emails_footer %>
7 <%= Setting.emails_footer %>
8 <% end -%>
@@ -596,6 +596,15 class MailerTest < ActiveSupport::TestCase
596 end
596 end
597 end
597 end
598
598
599 def test_layout_should_not_include_empty_emails_header
600 with_settings :emails_header => "", :plain_text_mail => 0 do
601 assert Mailer.test_email(User.find(1)).deliver
602 assert_select_email do
603 assert_select ".header", false
604 end
605 end
606 end
607
599 def test_layout_should_include_the_emails_footer
608 def test_layout_should_include_the_emails_footer
600 with_settings :emails_footer => "*Footer content*" do
609 with_settings :emails_footer => "*Footer content*" do
601 with_settings :plain_text_mail => 0 do
610 with_settings :plain_text_mail => 0 do
@@ -616,6 +625,23 class MailerTest < ActiveSupport::TestCase
616 end
625 end
617 end
626 end
618
627
628 def test_layout_should_include_the_emails_footer
629 with_settings :emails_footer => "" do
630 with_settings :plain_text_mail => 0 do
631 assert Mailer.test_email(User.find(1)).deliver
632 assert_select_email do
633 assert_select ".footer", false
634 end
635 end
636 with_settings :plain_text_mail => 1 do
637 assert Mailer.test_email(User.find(1)).deliver
638 mail = last_email
639 assert_not_nil mail
640 assert_not_include "\n-- \n", mail.body.decoded
641 end
642 end
643 end
644
619 def test_should_escape_html_templates_only
645 def test_should_escape_html_templates_only
620 Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a <tag>')
646 Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a <tag>')
621 mail = last_email
647 mail = last_email
General Comments 0
You need to be logged in to leave comments. Login now