Remove expectation of term case
This commit is contained in:
parent
5b01ac9288
commit
e41b6537f9
|
@ -288,7 +288,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def search_users
|
||||
term = (params[:term] || "").strip.downcase
|
||||
term = params[:term].to_s.strip
|
||||
topic_id = params[:topic_id]
|
||||
topic_id = topic_id.to_i if topic_id
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class UserSearch
|
|||
end
|
||||
|
||||
if term.length > 0
|
||||
sql << "where username_lower like :term_like or
|
||||
sql << "where username ilike :term_like or
|
||||
to_tsvector('simple', name) @@
|
||||
to_tsquery('simple',
|
||||
regexp_replace(
|
||||
|
|
|
@ -59,6 +59,16 @@ describe UsersController, :search_users do
|
|||
json = JSON.parse(response.body)
|
||||
json["users"].size.should == 3
|
||||
end
|
||||
|
||||
it "searches the user's username substring upper case" do
|
||||
xhr :post, :search_users, term: "MR"
|
||||
json = JSON.parse(response.body)
|
||||
json["users"].size.should == 6
|
||||
|
||||
xhr :post, :search_users, term: "MRB"
|
||||
json = JSON.parse(response.body)
|
||||
json["users"].size.should == 3
|
||||
end
|
||||
end
|
||||
|
||||
context "sort order respects users with posts on the topic" do
|
||||
|
|
Loading…
Reference in New Issue