From: simonbrandhof Date: Wed, 27 Apr 2011 10:41:44 +0000 (+0200) Subject: SONAR-2369 User list is not correctly sorted in the Groups page X-Git-Tag: 2.8~112 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=efe8153a423cb03d4f713acba6b1011361756892;p=sonarqube.git SONAR-2369 User list is not correctly sorted in the Groups page --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb index c8b9cb1b473..b83228c3c03 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb @@ -26,7 +26,7 @@ module RolesHelper end def all_users - User.find(:all, :order => 'login') + User.find(:all, :order => 'name') end def groups(role, resource_id=nil) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb index ba622929613..3acfda55b1a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/group.rb @@ -29,13 +29,13 @@ class Group < ActiveRecord::Base # all the users that are NOT members of this group def available_users - User.all - users + User.find(:all, :order => 'name') - users end def set_users(new_users=[]) self.users.clear - new_users=(new_users || []).compact.uniq + new_users=(new_users||[]).compact.uniq self.users = User.find(new_users) save end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb index 9176f859763..69bf41d343f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/user.rb @@ -78,7 +78,7 @@ class User < ActiveRecord::Base end def <=>(other) - login<=>other.login + name<=>other.name end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb index f96a1e0d906..0a162f38161 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb @@ -11,7 +11,7 @@

Non-members

@@ -26,7 +26,7 @@

Members


diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb index 2132abc7896..7882fe88bb3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb @@ -1,6 +1,6 @@ <% granted_users=users(@role, params[:resource]) - ungranted_users=all_users - granted_users + ungranted_users=(all_users - granted_users) if @project title=h(@project.name) elsif @role.starts_with?('default-')