From 604cffbeeda81299a36e8211ce57efa8aee4004f Mon Sep 17 00:00:00 2001 From: Z Date: Sat, 28 Dec 2019 14:51:33 +0800 Subject: [PATCH] fix bugs --- app/models/status.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index 1479d6709..c4bc9436f 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -85,8 +85,8 @@ 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, -> { 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 :without_reblogs, -> { joins('INNER JOIN statuses ori ON (statuses.reblog_of_id is NULL AND ori.id = statuses.id) OR ori.id = statuses.reblog_of_id') + .where('ori.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 }) }