about summary refs log tree commit diff
path: root/app/models/concerns/account_interactions.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-29 22:55:33 +0200
committerGitHub <noreply@github.com>2018-05-29 22:55:33 +0200
commit461542784b555237316f3dd5e32ea224cd3ab8ef (patch)
treebe4e11efcf7842cdffebf1c559e98f06659329d1 /app/models/concerns/account_interactions.rb
parent7706ed038f1a16d232635d564a28e6f90e53e0fd (diff)
Reduce wasted work in RemoveStatusService due to inactive followers (#7672)
Diffstat (limited to 'app/models/concerns/account_interactions.rb')
-rw-r--r--app/models/concerns/account_interactions.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/concerns/account_interactions.rb b/app/models/concerns/account_interactions.rb
index ae43711be..ef59f5d15 100644
--- a/app/models/concerns/account_interactions.rb
+++ b/app/models/concerns/account_interactions.rb
@@ -183,4 +183,15 @@ module AccountInteractions
   def pinned?(status)
     status_pins.where(status: status).exists?
   end
+
+  def followers_for_local_distribution
+    followers.local
+             .joins(:user)
+             .where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago)
+  end
+
+  def lists_for_local_distribution
+    lists.joins(account: :user)
+         .where('users.current_sign_in_at > ?', User::ACTIVE_DURATION.ago)
+  end
 end