FIX: Broken suspect user lists.
https://meta.discourse.org/t/server-error-code-500/68404
This commit is contained in:
parent
3a3dca32a3
commit
2d4d76472d
|
@ -4,8 +4,7 @@ class AdminUserIndexQuery
|
|||
|
||||
def initialize(params = {}, klass = User, trust_levels = TrustLevel.levels)
|
||||
@params = params
|
||||
@outer_query = initialize_query_with_order(klass)
|
||||
@query = klass.joins(:user_emails).distinct
|
||||
@query = initialize_query_with_order(klass.joins(:primary_email))
|
||||
@trust_levels = trust_levels
|
||||
end
|
||||
|
||||
|
@ -135,7 +134,7 @@ class AdminUserIndexQuery
|
|||
append filter_by_ip
|
||||
append filter_exclude
|
||||
append filter_by_search
|
||||
@outer_query.from(@query, 'users')
|
||||
@query
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -88,6 +88,16 @@ describe AdminUserIndexQuery do
|
|||
|
||||
end
|
||||
|
||||
describe 'with a suspected user' do
|
||||
let(:user) { Fabricate(:active_user, created_at: 1.day.ago) }
|
||||
|
||||
it 'finds the suspected user' do
|
||||
user
|
||||
query = AdminUserIndexQuery.new(query: 'suspect')
|
||||
expect(query.find_users).to eq([user])
|
||||
end
|
||||
end
|
||||
|
||||
describe "with a pending user" do
|
||||
|
||||
let!(:user) { Fabricate(:user, approved: false) }
|
||||
|
|
Loading…
Reference in New Issue