]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3447 Users with accents are now shown in the "Assign To" list
authorDavid Gageot <david@gageot.net>
Thu, 14 Jun 2012 14:00:52 +0000 (16:00 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 14 Jun 2012 15:31:58 +0000 (17:31 +0200)
In fact we completely ignore the accents so that e=é,a=à...

sonar-server/src/main/webapp/WEB-INF/app/controllers/users_controller.rb

index 30b06744cf32deb76b3e5ff457dd650f3a1da7a5..755bf5a9bfce8809ca5e1248f8a5c6a4ab9544e4 100644 (file)
@@ -169,7 +169,8 @@ class UsersController < ApplicationController
   end
 
   def autocomplete
-    @users = User.find(:all, :conditions => ["UPPER(name) like ? AND active=?", params[:user_name_start].clone.upcase+"%", true])
+    starts_with = Regexp.new(params[:user_name_start].parameterize.upcase + '(.*)')
+    @users = User.find(:all, :conditions => ["active=?", true]).to_a.select { |user| user.name.parameterize.upcase =~ starts_with }
     @char_count = params[:user_name_start].size
     render :partial => 'autocomplete'
   end