summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/wiki_formatting/macros.rb2
-rw-r--r--test/unit/mailer_test.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index a2acd07eb..cb4976eb7 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -281,7 +281,7 @@ module Redmine
container = obj.is_a?(Journal) ? obj.journalized : obj
attachments = container.attachments if container.respond_to?(:attachments)
- if (controller_name == 'previews' || action_name == 'preview') && @attachments.present?
+ if (controller_path == 'previews' || action_name == 'preview') && @attachments.present?
attachments = (attachments.to_a + @attachments).compact
end
if attachments.present? && (attachment = Attachment.latest_attach(attachments, filename))
diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb
index ee029d3e6..889035a27 100644
--- a/test/unit/mailer_test.rb
+++ b/test/unit/mailer_test.rb
@@ -199,6 +199,18 @@ class MailerTest < ActiveSupport::TestCase
end
end
+ def test_thumbnail_macro_in_email
+ set_tmp_attachments_directory
+ issue = Issue.generate!(:description => '{{thumbnail(image.png)}}')
+ issue.attachments << Attachment.new(:file => mock_file_with_options(:original_filename => 'image.png'), :author => User.find(1))
+ issue.save!
+
+ assert Mailer.deliver_issue_add(issue)
+ assert_select_email do
+ assert_select 'img[alt="image.png"]'
+ end
+ end
+
def test_email_headers
with_settings :mail_from => 'Redmine <redmine@example.net>' do
issue = Issue.find(1)