Refactor StatusThreadingConcern (#9626)

* Remove #filter_from_context?

* Create scope Status.with_accounts

Retrieving AR objects should be
their model's scope
This commit is contained in:
ysksn 2020-01-11 19:55:33 +09:00 committed by Yamagishi Kazutoshi
parent c10ff359a2
commit 6f8f018e3e
2 changed files with 3 additions and 10 deletions

View file

@ -83,6 +83,7 @@ class Status < ApplicationRecord
scope :remote, -> { where(local: false).where.not(uri: nil) }
scope :local, -> { where(local: true).or(where(uri: nil)) }
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 :with_public_visibility, -> { where(visibility: :public) }