Project

General

Profile

Defect #37881 » fix-37881.patch

Mizuki ISHIKAWA, 2022-12-21 02:08

View differences:

lib/redmine/wiki_formatting/macros.rb
size = size.to_i
size = 200 unless size > 0
attachments = obj.attachments if obj.respond_to?(:attachments)
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?
attachments = (attachments.to_a + @attachments).compact
end
test/functional/issues_controller_test.rb
end
end
def test_show_should_be_available_with_thumbnail_macro_of_another_journal_attachment_of_the_same_issue
@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
(2-2/2)