Commit 1aabfcb92d41f690e6756a7f057e85f17e30a0db

Authored by Marin Jankovski
1 parent 961d8793

Change the user search query to be case insensitive.

Showing 2 changed files with 2 additions and 1 deletions   Show diff stats
1 v 6.8.0 1 v 6.8.0
2 - Ability to at mention users that are participating in issue and merge req. discussion 2 - Ability to at mention users that are participating in issue and merge req. discussion
3 - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) 3 - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu)
  4 + - Make user search case-insensitive (Christopher Arnold)
4 5
5 v 6.7.2 6 v 6.7.2
6 - Fix upgrader script 7 - Fix upgrader script
app/models/user.rb
@@ -204,7 +204,7 @@ class User < ActiveRecord::Base @@ -204,7 +204,7 @@ class User < ActiveRecord::Base
204 end 204 end
205 205
206 def search query 206 def search query
207 - where("name LIKE :query OR email LIKE :query OR username LIKE :query", query: "%#{query}%") 207 + where("lower(name) LIKE :query OR lower(email) LIKE :query OR lower(username) LIKE :query", query: "%#{query.downcase}%")
208 end 208 end
209 209
210 def by_username_or_id(name_or_id) 210 def by_username_or_id(name_or_id)