diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/status.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/status.rb b/app/models/status.rb index 42d5dd9ae..1a5197e88 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -52,7 +52,7 @@ class Status < ApplicationRecord belongs_to :application, class_name: 'Doorkeeper::Application', optional: true belongs_to :account, inverse_of: :statuses - belongs_to :in_reply_to_account, foreign_key: 'in_reply_to_account_id', class_name: 'Account', optional: true + belongs_to :in_reply_to_account, class_name: 'Account', optional: true belongs_to :conversation, optional: true belongs_to :preloadable_poll, class_name: 'Poll', foreign_key: 'poll_id', optional: true @@ -380,7 +380,7 @@ class Status < ApplicationRecord return if account_ids.empty? - accounts = Account.where(id: account_ids).includes(:account_stat).each_with_object({}) { |a, h| h[a.id] = a } + accounts = Account.where(id: account_ids).includes(:account_stat).index_by(&:id) cached_items.each do |item| item.account = accounts[item.account_id] @@ -518,9 +518,7 @@ class Status < ApplicationRecord end def set_locality - if account.domain.nil? && !attribute_changed?(:local_only) - self.local_only = marked_local_only? - end + self.local_only = marked_local_only? if account.domain.nil? && !attribute_changed?(:local_only) end def set_conversation |