mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Follow #30932
This commit is contained in:
parent
bf7a44a8d0
commit
3ca447bd8d
2 changed files with 6 additions and 2 deletions
|
@ -281,6 +281,10 @@ class Status < ApplicationRecord
|
||||||
@emojis = CustomEmoji.from_text(fields.join(' '), account.domain)
|
@emojis = CustomEmoji.from_text(fields.join(' '), account.domain)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def media_attachments_limit
|
||||||
|
local? ? MEDIA_ATTACHMENTS_LIMIT : REMOTE_MEDIA_ATTACHMENTS_LIMIT
|
||||||
|
end
|
||||||
|
|
||||||
def ordered_media_attachments
|
def ordered_media_attachments
|
||||||
if ordered_media_attachment_ids.nil?
|
if ordered_media_attachment_ids.nil?
|
||||||
# NOTE: sort Ruby-side to avoid hitting the database when the status is
|
# NOTE: sort Ruby-side to avoid hitting the database when the status is
|
||||||
|
@ -289,7 +293,7 @@ class Status < ApplicationRecord
|
||||||
else
|
else
|
||||||
map = media_attachments.index_by(&:id)
|
map = media_attachments.index_by(&:id)
|
||||||
ordered_media_attachment_ids.filter_map { |media_attachment_id| map[media_attachment_id] }
|
ordered_media_attachment_ids.filter_map { |media_attachment_id| map[media_attachment_id] }
|
||||||
end.take(MEDIA_ATTACHMENTS_LIMIT)
|
end.take(media_attachments_limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
def replies_count
|
def replies_count
|
||||||
|
|
|
@ -60,7 +60,7 @@ class StatusEdit < ApplicationRecord
|
||||||
map = status.media_attachments.index_by(&:id)
|
map = status.media_attachments.index_by(&:id)
|
||||||
ordered_media_attachment_ids.map.with_index { |media_attachment_id, index| PreservedMediaAttachment.new(media_attachment: map[media_attachment_id], description: media_descriptions[index]) }
|
ordered_media_attachment_ids.map.with_index { |media_attachment_id, index| PreservedMediaAttachment.new(media_attachment: map[media_attachment_id], description: media_descriptions[index]) }
|
||||||
end
|
end
|
||||||
end.take(Status::MEDIA_ATTACHMENTS_LIMIT)
|
end.take(status.media_attachments_limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
def proper
|
def proper
|
||||||
|
|
Loading…
Reference in a new issue