0
0
Fork 0

Prevent suspended accounts from appearing in AccountSearchService (#7246)

This commit is contained in:
Emelia Smith 2018-04-23 21:27:18 +02:00 committed by Eugen Rochko
parent 53b1d88873
commit 495303d9b8
3 changed files with 22 additions and 2 deletions

View file

@ -117,6 +117,7 @@ class Account < ApplicationRecord
scope :partitioned, -> { order(Arel.sql('row_number() over (partition by domain)')) }
scope :silenced, -> { where(silenced: true) }
scope :suspended, -> { where(suspended: true) }
scope :without_suspended, -> { where(suspended: false) }
scope :recent, -> { reorder(id: :desc) }
scope :alphabetic, -> { order(domain: :asc, username: :asc) }
scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') }

View file

@ -65,9 +65,9 @@ class AccountSearchService < BaseService
def exact_match
@_exact_match ||= begin
if domain_is_local?
search_from.find_local(query_username)
search_from.without_suspended.find_local(query_username)
else
search_from.find_remote(query_username, query_domain)
search_from.without_suspended.find_remote(query_username, query_domain)
end
end
end