Defect #37379 » fix-37379.patch
lib/redmine/wiki_formatting/macros.rb | ||
---|---|---|
278 | 278 | |
279 | 279 |
size = size.to_i |
280 | 280 |
size = 200 unless size > 0 |
281 |
if obj && obj.respond_to?(:attachments) && |
|
282 |
attachment = Attachment.latest_attach(obj.attachments, filename) |
|
281 | ||
282 |
attachments = obj.attachments if obj && obj.respond_to?(:attachments) |
|
283 |
attachments = (attachments.to_a + @attachments).compact if (controller_name == 'previews' || action_name == 'preview') && @attachments.present? |
|
284 |
if attachments.present? && (attachment = Attachment.latest_attach(attachments, filename)) |
|
283 | 285 |
title = options[:title] || attachment.title |
284 | 286 |
thumbnail_url = |
285 | 287 |
url_for(:controller => 'attachments', :action => 'thumbnail', |
test/functional/previews_controller_test.rb | ||
---|---|---|
88 | 88 |
assert_select 'a.attachment', :text => 'foo.bar' |
89 | 89 |
end |
90 | 90 | |
91 |
def test_preview_issue_notes_should_view_thumbnail_of_the_file_after_attachment |
|
92 |
attachment = Attachment.generate!(filename: 'foo.bar', digest: 'd') |
|
93 |
attachment.update(container: nil) |
|
94 | ||
95 |
@request.session[:user_id] = 2 |
|
96 |
post( |
|
97 |
:issue, |
|
98 |
params: { |
|
99 |
project_id: '1', |
|
100 |
issue_id: 1, |
|
101 |
field: 'notes', |
|
102 |
text: '{{thumbnail(foo.bar)}}', |
|
103 |
attachments: {'1': { token: attachment.token }} |
|
104 |
} |
|
105 |
) |
|
106 |
assert_response :success |
|
107 |
assert_select 'a.thumbnail[title=?]', 'foo.bar' |
|
108 |
end |
|
109 | ||
91 | 110 |
def test_preview_new_news |
92 | 111 |
get( |
93 | 112 |
:news, |
- « Previous
- 1
- 2
- Next »