From 112a3f07546f8cfebdba98085ec8727e856f9ca2 Mon Sep 17 00:00:00 2001 From: Z Date: Sat, 28 Dec 2019 14:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=BD=B4=E5=8F=AA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AF=B9=E8=87=AA=E5=B7=B1=E7=9A=84=E8=BD=AC=E5=98=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/status.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index 00a302721..1479d6709 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -84,7 +84,9 @@ class Status < ApplicationRecord #scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') } scope :without_replies, -> { where('statuses.reply = FALSE') } - scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') } + #scope :without_reblogs, -> { where('statuses.reblog_of_id IS NULL') } + scope :without_reblogs, -> { joins('INNER JOIN statuses reblog ON reblog.id = statuses.reblog_of_id') + .where('statuses.reblog_of_id IS NULL OR reblog.account_id = statuses.account_id') } scope :with_public_visibility, -> { where(visibility: :public) } scope :tagged_with, ->(tag) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag }) } scope :excluding_silenced_accounts, -> { left_outer_joins(:account).where(accounts: { silenced_at: nil }) } @@ -363,7 +365,7 @@ class Status < ApplicationRecord starting_scope = local_only ? Status.local : Status starting_scope .with_public_visibility - #.without_reblogs + .without_reblogs end def apply_timeline_filters(query, account, local_only)