about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-07-13 12:40:27 -0500
committerFire Demon <firedemon@creature.cafe>2020-08-30 05:41:03 -0500
commita4f8ca3e8b614517d904a63da0874245d419e4da (patch)
tree72b19318388d403ad56217ff455727fa2b80f3aa /app
parent635cd806c57f41430e05acf2bafbcc33a32f935d (diff)
[Refactoring] Minor code style auto-refactorings from Rubocop
Diffstat (limited to 'app')
-rw-r--r--app/models/status.rb8
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