From: Jean-Philippe Lang Date: Sat, 31 Dec 2016 12:35:15 +0000 (+0000) Subject: Don't reload attachments if they are already loaded. X-Git-Tag: 3.4.0~475 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d521e49dbd3c48773c5e29abba6d325fbb5142c6;p=redmine.git Don't reload attachments if they are already loaded. git-svn-id: http://svn.redmine.org/redmine/trunk@16113 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index 217382476..f7098322b 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -34,7 +34,12 @@ module AttachmentsHelper def link_to_attachments(container, options = {}) options.assert_valid_keys(:author, :thumbnails) - attachments = container.attachments.preload(:author).to_a + attachments = if container.attachments.loaded? + container.attachments + else + container.attachments.preload(:author).to_a + end + if attachments.any? options = { :editable => container.attachments_editable?,