summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Javier López <fjlopez@gitlab.com>2017-12-14 12:48:01 +0100
committerFrancisco Javier López <fjlopez@gitlab.com>2017-12-14 12:48:01 +0100
commit9119c36348068c3f1be112a0f59ca9f1215b320c (patch)
tree27768954c1269c23120a87e885d3e787742e1fad
parentebfe269e848b13fb45f366ff1c953d8475f39ffa (diff)
downloadgitlab-ce-sh-optimize-groups-api-10-2.tar.gz
Resolving conflictsh-optimize-groups-api-10-2
-rw-r--r--lib/api/groups.rb28
1 files changed, 5 insertions, 23 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index a0f85c5bc3d..573382738ce 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -25,24 +25,7 @@ module API
optional :statistics, type: Boolean, default: false, desc: 'Include project statistics'
end
- def present_groups(groups, options = {})
- options = options.reverse_merge(
- with: Entities::Group,
- current_user: current_user
- )
-
- groups = groups.with_statistics if options[:statistics]
- present paginate(groups), options
- end
- end
-
- resource :groups do
- include CustomAttributesEndpoints
-
- desc 'Get a groups list' do
- success Entities::Group
- end
- params do
+ params :group_list_params do
use :statistics_params
optional :skip_groups, type: Array[Integer], desc: 'Array of group ids to exclude from list'
optional :all_available, type: Boolean, desc: 'Show all group that you have access to'
@@ -76,12 +59,11 @@ module API
paginate(projects)
end
- def present_groups(params, groups)
- options = {
+ def present_groups(groups, options = {})
+ options = options.reverse_merge(
with: Entities::Group,
- current_user: current_user,
- statistics: params[:statistics] && current_user.admin?
- }
+ current_user: current_user
+ )
groups = groups.with_statistics if options[:statistics]
present paginate(groups), options