diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-04-18 00:58:24 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-04-18 00:58:24 +0000 |
commit | 19f70c95d1ae67bf7e12d2d90debfd17ab7faec8 (patch) | |
tree | f08633b41d3f1e2e9412b013ab616b6c7f8dcee9 | |
parent | 9fea2ab6d2242261cbb565c808c20df6a36ed831 (diff) | |
download | redmine-19f70c95d1ae67bf7e12d2d90debfd17ab7faec8.tar.gz redmine-19f70c95d1ae67bf7e12d2d90debfd17ab7faec8.zip |
not add empty header/footer to notification emails (#13482)
Contributed by Max Horn.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11721 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/views/layouts/mailer.html.erb | 4 | ||||
-rw-r--r-- | app/views/layouts/mailer.text.erb | 4 | ||||
-rw-r--r-- | test/unit/mailer_test.rb | 26 |
3 files changed, 34 insertions, 0 deletions
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 056196cd3..b100fe75d 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -25,9 +25,13 @@ hr { </style> </head> <body> +<% if Setting.emails_header.present? -%> <span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header).html_safe %></span> +<% end -%> <%= yield %> <hr /> +<% if Setting.emails_footer.present? -%> <span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer).html_safe %></span> +<% end -%> </body> </html> diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 4b8c0b4f5..a4c69862b 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,4 +1,8 @@ +<% if Setting.emails_header.present? -%> <%= Setting.emails_header %> +<% end -%> <%= yield %> +<% if Setting.emails_footer.present? -%> -- <%= Setting.emails_footer %> +<% end -%> diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index fff0113c6..d6429545e 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -596,6 +596,15 @@ class MailerTest < ActiveSupport::TestCase end end + def test_layout_should_not_include_empty_emails_header + with_settings :emails_header => "", :plain_text_mail => 0 do + assert Mailer.test_email(User.find(1)).deliver + assert_select_email do + assert_select ".header", false + end + end + end + def test_layout_should_include_the_emails_footer with_settings :emails_footer => "*Footer content*" do with_settings :plain_text_mail => 0 do @@ -616,6 +625,23 @@ class MailerTest < ActiveSupport::TestCase end end + def test_layout_should_include_the_emails_footer + with_settings :emails_footer => "" do + with_settings :plain_text_mail => 0 do + assert Mailer.test_email(User.find(1)).deliver + assert_select_email do + assert_select ".footer", false + end + end + with_settings :plain_text_mail => 1 do + assert Mailer.test_email(User.find(1)).deliver + mail = last_email + assert_not_nil mail + assert_not_include "\n-- \n", mail.body.decoded + end + end + end + def test_should_escape_html_templates_only Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'Subject with a <tag>') mail = last_email |