summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-12-30 09:00:14 +0000
committerGo MAEDA <maeda@farend.jp>2022-12-30 09:00:14 +0000
commiteb399b83a500f77469011cc27da0b0cf15ec3937 (patch)
tree94761434ba11a31c57975e86a539d6bb5054ca0d /test
parentb7078d78dd56218744c691bd68f89548a7bbfa9d (diff)
downloadredmine-eb399b83a500f77469011cc27da0b0cf15ec3937.tar.gz
redmine-eb399b83a500f77469011cc27da0b0cf15ec3937.zip
Fix `{{thumbnail}}` macro in an issue note cannot fetch an image attached in a different note (#37881).
Patch by Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@22012 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/issues_controller_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 58e51348a..9c387a341 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -8457,6 +8457,22 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
+ def test_show_with_thumbnail_macro_should_be_able_to_fetch_image_of_different_journal
+ @request.session[:user_id] = 1
+ issue = Issue.find(2)
+ attachment = Attachment.generate!(filename: 'foo.png', digest: Redmine::Utils.random_hex(32))
+ attachment.update(container: issue)
+
+ issue.init_journal(User.first, "{{thumbnail(#{attachment.filename})}}")
+ issue.save!
+ issue.reload
+
+ get :show, params: { id: issue.id }
+ assert_select "div#history div#journal-#{issue.journals.last.id}-notes" do
+ assert_select "a.thumbnail[title=?][href='/attachments/#{attachment.id}']", 'foo.png'
+ end
+ end
+
def test_index_should_retrieve_default_query
query = IssueQuery.find(4)
IssueQuery.stubs(:default).returns query