about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2020-01-11 19:55:33 +0900
committermultiple creatures <dev@multiple-creature.party>2020-02-27 13:30:57 -0600
commit856c36af97c1f12013532a382ed9a44c1f97d6ac (patch)
treef27fdefbae32cb7c0de2dc077f089dc5e68830b4 /app/models/status.rb
parentdf1c0bc8537dd57c10040925fac62f7acb785736 (diff)
port tootsuite#9626 to monsterfork: Refactor StatusThreadingConcern
* Remove #filter_from_context?

* Create scope Status.with_accounts

Retrieving AR objects should be
their model's scope
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index c61bc0a5f..05061bce1 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -104,6 +104,7 @@ class Status < ApplicationRecord
   scope :curated, -> { where(curated: true) }
   scope :hidden, -> { where(hidden: true) }
 
+  scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
   scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
   scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') }
   scope :reblogs, -> { where('statuses.reblog_of_id IS NOT NULL') } # all reblogs