diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-08-05 15:21:25 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-08-05 15:21:34 +0200 |
commit | 42d098015ceadafb673aaf3f12c718c00e52b857 (patch) | |
tree | ed51d4aed555f21249c151636a53f3c35c123666 /server | |
parent | 100c7138734b67187175f38a0f85bebc71794087 (diff) | |
download | sonarqube-42d098015ceadafb673aaf3f12c718c00e52b857.tar.gz sonarqube-42d098015ceadafb673aaf3f12c718c00e52b857.zip |
SONAR-4963 Return group description in /user_groups/search
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/webapp/WEB-INF/app/controllers/user_groups_controller.rb | 14 |
2 files changed, 11 insertions, 6 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java index 62da695d7d7..581eaa863be 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/GroupMembershipFinderTest.java @@ -48,7 +48,7 @@ public class GroupMembershipFinderTest { public void find() throws Exception { GroupMembershipQuery query = GroupMembershipQuery.builder().login("arthur").build(); when(groupMembershipDao.selectGroups(eq(query), anyLong(), anyInt(), anyInt())).thenReturn( - newArrayList(new GroupMembershipDto().setId(1L).setName("users").setUserId(100L)) + newArrayList(new GroupMembershipDto().setId(1L).setName("users").setDescription("Users group").setUserId(100L)) ); GroupMembershipFinder.Membership result = finder.find(query); @@ -58,6 +58,7 @@ public class GroupMembershipFinderTest { GroupMembership group = result.groups().get(0); assertThat(group.id()).isEqualTo(1); assertThat(group.name()).isEqualTo("users"); + assertThat(group.description()).isEqualTo("Users group"); assertThat(group.isMember()).isTrue(); } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/user_groups_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/user_groups_controller.rb index 90cd2dc0ec8..94a4671a614 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/user_groups_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/user_groups_controller.rb @@ -33,11 +33,15 @@ class UserGroupsController < ApplicationController format.json { render :json => { :more => more, - :results => groups.map { |group| { - :id => group.id(), - :name => group.name(), - :selected => group.isMember() - }} + :results => groups.map { |group| + hash = { + :id => group.id(), + :name => group.name(), + :selected => group.isMember() + } + hash[:description] = group.description() if group.description() && !group.description().blank? + hash + } } } end |