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)
|
def initialize(params = {}, klass = User, trust_levels = TrustLevel.levels)
|
||||||
@params = params
|
@params = params
|
||||||
@outer_query = initialize_query_with_order(klass)
|
@query = initialize_query_with_order(klass.joins(:primary_email))
|
||||||
@query = klass.joins(:user_emails).distinct
|
|
||||||
@trust_levels = trust_levels
|
@trust_levels = trust_levels
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +134,7 @@ class AdminUserIndexQuery
|
||||||
append filter_by_ip
|
append filter_by_ip
|
||||||
append filter_exclude
|
append filter_exclude
|
||||||
append filter_by_search
|
append filter_by_search
|
||||||
@outer_query.from(@query, 'users')
|
@query
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,6 +88,16 @@ describe AdminUserIndexQuery do
|
||||||
|
|
||||||
end
|
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
|
describe "with a pending user" do
|
||||||
|
|
||||||
let!(:user) { Fabricate(:user, approved: false) }
|
let!(:user) { Fabricate(:user, approved: false) }
|
||||||
|
|
Loading…
Reference in New Issue