From 31c633e528393e4b3ebfdf89d48d50bbe53f7104 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 11 Feb 2017 19:16:10 +0100 Subject: [PATCH] Fix Status.permitted_for scope query --- app/models/status.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index 93594ec8f4..e440bbacab 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -158,8 +158,7 @@ class Status < ApplicationRecord elsif !account.nil? && target_account.blocking?(account) where('1 = 0') elsif !account.nil? - joins('LEFT OUTER JOIN mentions ON statuses.id = mentions.status_id') - .where('mentions.account_id = ?', account.id) + joins('LEFT OUTER JOIN mentions ON statuses.id = mentions.status_id AND mentions.account_id = ' + account.id.to_s) .where('statuses.visibility != ? OR mentions.id IS NOT NULL', Status.visibilities[:private]) else where.not(visibility: :private)