1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-01 03:57:15 +00:00

Unify duplicate codes (#37687).

Patch by Go MAEDA.


git-svn-id: https://svn.redmine.org/redmine/trunk@21832 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2022-09-23 04:47:49 +00:00
parent 43c7cc03a5
commit d7df1a740e
2 changed files with 2 additions and 3 deletions

View File

@ -21,8 +21,7 @@ module JournalsHelper
# Returns the attachments of a journal that are displayed as thumbnails
def journal_thumbnail_attachments(journal)
ids = journal.details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key)
ids.any? ? Attachment.where(:id => ids).select(&:thumbnailable?).sort_by{|a| ids.index(a.id.to_s)} : []
journal.attachments.select(&:thumbnailable?)
end
# Returns the action links for an issue journal

View File

@ -143,7 +143,7 @@ class Journal < ActiveRecord::Base
def attachments
ids = details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key)
Attachment.where(id: ids).to_a
Attachment.where(id: ids).sort_by {|a| ids.index(a.id.to_s)}
end
# Returns a string of css classes