Browse Source

Merged r22285 from trunk to 5.0-stable (#38697).


git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22286 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/5.0.6
Go MAEDA 9 months ago
parent
commit
001e48a151
2 changed files with 13 additions and 1 deletions
  1. 1
    1
      lib/redmine/wiki_formatting/macros.rb
  2. 12
    0
      test/unit/mailer_test.rb

+ 1
- 1
lib/redmine/wiki_formatting/macros.rb View File

@@ -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))

+ 12
- 0
test/unit/mailer_test.rb View File

@@ -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)

Loading…
Cancel
Save