Fix media attachment order of remote posts (#28469)
This commit is contained in:
parent
a4d49c236d
commit
2bf84b93d4
3 changed files with 15 additions and 4 deletions
|
@ -277,7 +277,9 @@ class Status < ApplicationRecord
|
|||
|
||||
def ordered_media_attachments
|
||||
if ordered_media_attachment_ids.nil?
|
||||
media_attachments
|
||||
# NOTE: sort Ruby-side to avoid hitting the database when the status is
|
||||
# not persisted to database yet
|
||||
media_attachments.sort_by(&:id)
|
||||
else
|
||||
map = media_attachments.index_by(&:id)
|
||||
ordered_media_attachment_ids.filter_map { |media_attachment_id| map[media_attachment_id] }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue