mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
FIX: moderators should be able to search users by email
This commit is contained in:
@ -96,34 +96,23 @@ describe AdminUserIndexQuery do
|
||||
describe "filtering" do
|
||||
|
||||
context "by email fragment" do
|
||||
|
||||
before(:each) { Fabricate(:user, email: "test1@example.com") }
|
||||
|
||||
context "when authenticated as a non-admin user" do
|
||||
|
||||
it "doesn't match the email" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "test1@example.com" })
|
||||
expect(query.find_users.count()).to eq(0)
|
||||
end
|
||||
|
||||
it "matches the email" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "est1" })
|
||||
expect(query.find_users.count()).to eq(1)
|
||||
end
|
||||
|
||||
context "when authenticated as an admin user" do
|
||||
|
||||
it "matches the email" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "est1", admin: true })
|
||||
expect(query.find_users.count()).to eq(1)
|
||||
end
|
||||
|
||||
it "matches the email using any case" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "Test1", admin: true })
|
||||
expect(query.find_users.count()).to eq(1)
|
||||
end
|
||||
|
||||
it "matches the email using any case" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "Test1" })
|
||||
expect(query.find_users.count()).to eq(1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "by username fragment" do
|
||||
|
||||
before(:each) { Fabricate(:user, username: "test_user_1") }
|
||||
|
||||
it "matches the username" do
|
||||
@ -138,7 +127,8 @@ describe AdminUserIndexQuery do
|
||||
end
|
||||
|
||||
context "by ip address fragment" do
|
||||
before(:each) { Fabricate(:user, ip_address: "117.207.94.9") }
|
||||
|
||||
let!(:user) { Fabricate(:user, ip_address: "117.207.94.9") }
|
||||
|
||||
it "matches the ip address" do
|
||||
query = ::AdminUserIndexQuery.new({ filter: "117.207.94.9" })
|
||||
|
Reference in New Issue
Block a user