aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-04-27 12:41:44 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-04-27 12:41:44 +0200
commitefe8153a423cb03d4f713acba6b1011361756892 (patch)
treeff625c6106fef23c65c202dcc250d44c3eddb213
parentd69404ccb46f0462e432bef3196d76f825ce6927 (diff)
downloadsonarqube-efe8153a423cb03d4f713acba6b1011361756892.tar.gz
sonarqube-efe8153a423cb03d4f713acba6b1011361756892.zip
SONAR-2369 User list is not correctly sorted in the Groups page
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/group.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/user.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/groups/select_user.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb2
5 files changed, 7 insertions, 7 deletions
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 @@
<td style="padding: 5px 0pt;" valign="top">
<h2>Non-members</h2>
<select name="from" id="from" size="10" style="margin: 5px 0pt; width: 300px;" multiple="multiple">
- <% @group.available_users.each do |user| %>
+ <% @group.available_users.sort.each do |user| %>
<option value="<%= user.id -%>"><%= user.login %></option>
<% end %>
</select>
@@ -26,7 +26,7 @@
<h2>Members</h2>
<select name="users[]" id="to" size="10" multiple="multiple" style="margin: 5px 0pt; width: 300px;">
- <%= options_from_collection_for_select(@group.users, "id", "login") %>
+ <%= options_from_collection_for_select(@group.users.sort, "id", "login") %>
</select><br>
<div style="padding: 5px 0pt;">
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-')