summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-08-30 07:42:21 +0000
committerGo MAEDA <maeda@farend.jp>2023-08-30 07:42:21 +0000
commit84af85d56a3d5c9f718bd3291b528e4c4cc7c171 (patch)
treee04cedb2755c43d9b33289a4fe3444c6f5a5d71d
parent5965b4054d9d2466a6f3dd2931085ac8896cada3 (diff)
downloadredmine-84af85d56a3d5c9f718bd3291b528e4c4cc7c171.tar.gz
redmine-84af85d56a3d5c9f718bd3291b528e4c4cc7c171.zip
Merged r22285 from trunk to 4.2-stable (#38697).
git-svn-id: https://svn.redmine.org/redmine/branches/4.2-stable@22287 e93f8b46-1217-0410-a6f0-8f06a7374b81
-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 be398c5a6..9d9b1c2d0 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -280,7 +280,7 @@ module Redmine
size = 200 unless size > 0
attachments = obj.attachments if obj.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 b25f00643..6a5ee182f 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)