Merge tag 'v2.6.5' into instance_only_statuses
This commit is contained in:
@ -91,6 +91,7 @@ class Status < ApplicationRecord
|
||||
:conversation,
|
||||
:status_stat,
|
||||
:tags,
|
||||
:preview_cards,
|
||||
:stream_entry,
|
||||
active_mentions: :account,
|
||||
reblog: [
|
||||
@ -98,6 +99,7 @@ class Status < ApplicationRecord
|
||||
:application,
|
||||
:stream_entry,
|
||||
:tags,
|
||||
:preview_cards,
|
||||
:media_attachments,
|
||||
:conversation,
|
||||
:status_stat,
|
||||
@ -169,6 +171,10 @@ class Status < ApplicationRecord
|
||||
reblog
|
||||
end
|
||||
|
||||
def preview_card
|
||||
preview_cards.first
|
||||
end
|
||||
|
||||
def title
|
||||
if destroyed?
|
||||
"#{account.acct} deleted status"
|
||||
@ -242,10 +248,6 @@ class Status < ApplicationRecord
|
||||
before_validation :set_local
|
||||
|
||||
class << self
|
||||
def cache_ids
|
||||
left_outer_joins(:status_stat).select('statuses.id, greatest(statuses.updated_at, status_stats.updated_at) AS updated_at')
|
||||
end
|
||||
|
||||
def selectable_visibilities
|
||||
visibilities.keys - %w(direct limited)
|
||||
end
|
||||
@ -316,19 +318,19 @@ class Status < ApplicationRecord
|
||||
end
|
||||
|
||||
def favourites_map(status_ids, account_id)
|
||||
Favourite.select('status_id').where(status_id: status_ids).where(account_id: account_id).map { |f| [f.status_id, true] }.to_h
|
||||
Favourite.select('status_id').where(status_id: status_ids).where(account_id: account_id).each_with_object({}) { |f, h| h[f.status_id] = true }
|
||||
end
|
||||
|
||||
def reblogs_map(status_ids, account_id)
|
||||
select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).reorder(nil).map { |s| [s.reblog_of_id, true] }.to_h
|
||||
select('reblog_of_id').where(reblog_of_id: status_ids).where(account_id: account_id).reorder(nil).each_with_object({}) { |s, h| h[s.reblog_of_id] = true }
|
||||
end
|
||||
|
||||
def mutes_map(conversation_ids, account_id)
|
||||
ConversationMute.select('conversation_id').where(conversation_id: conversation_ids).where(account_id: account_id).map { |m| [m.conversation_id, true] }.to_h
|
||||
ConversationMute.select('conversation_id').where(conversation_id: conversation_ids).where(account_id: account_id).each_with_object({}) { |m, h| h[m.conversation_id] = true }
|
||||
end
|
||||
|
||||
def pins_map(status_ids, account_id)
|
||||
StatusPin.select('status_id').where(status_id: status_ids).where(account_id: account_id).map { |p| [p.status_id, true] }.to_h
|
||||
StatusPin.select('status_id').where(status_id: status_ids).where(account_id: account_id).each_with_object({}) { |p, h| h[p.status_id] = true }
|
||||
end
|
||||
|
||||
def reload_stale_associations!(cached_items)
|
||||
@ -343,7 +345,7 @@ class Status < ApplicationRecord
|
||||
|
||||
return if account_ids.empty?
|
||||
|
||||
accounts = Account.where(id: account_ids).map { |a| [a.id, a] }.to_h
|
||||
accounts = Account.where(id: account_ids).each_with_object({}) { |a, h| h[a.id] = a }
|
||||
|
||||
cached_items.each do |item|
|
||||
item.account = accounts[item.account_id]
|
||||
|
Reference in New Issue
Block a user