From 856c36af97c1f12013532a382ed9a44c1f97d6ac Mon Sep 17 00:00:00 2001 From: ysksn Date: Sat, 11 Jan 2020 19:55:33 +0900 Subject: 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 --- app/models/status.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models/status.rb') 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 -- cgit