summaryrefslogtreecommitdiff
path: root/lib/api/groups.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-12-05 10:22:07 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-12-05 10:22:07 +0000
commitc1390bd98ccb0368f700117097f47d6ff488fdba (patch)
treec4f383b778c8a3d33bdbb82d84c8fd7a91d3fbdf /lib/api/groups.rb
parente416d6ff1d020ec510ab71bfdbcfbc72b14cd44a (diff)
parent4ca4b0ff702a68a9aed5da70d9170da410eefafa (diff)
downloadgitlab-ce-38869-templates.tar.gz
Merge branch 'master' into 38869-templates38869-templates
* master: (50 commits) remove ambiguity about which resource type to be using for new sessions Backport changes from refactor sidebar weight block Vue and move to Issue Boards Migrate Gitlab::Git::Repository#cherry_pick to Gitaly show status of issue links in wiki page issue note component rename Prevent job link form rendering when user does not have permissions Move SingleRepositoryWorker#fsck into Gitlab::Git::Repository Import axios utils in commons Update parser gem to remove warning about wrong ruby version Merge branch 'master-i18n' into 'master' Reduce pipeline chain life span to minimize side effects Add CHANGELOG entry Refactor GCP Client#user_agent_header to use #tap Remove seed file from the development env Fixed bug Fix watch level for mentions in description Add notice to gollum initializer Add underline hover state to all links Moving query to base count service Added default order to UserFinder ...
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r--lib/api/groups.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index bcf2e6dae1d..b81f07a1770 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -52,6 +52,13 @@ module API
groups
end
+ def find_group_projects(params)
+ group = find_group!(params[:id])
+ projects = GroupProjectsFinder.new(group: group, current_user: current_user, params: project_finder_params).execute
+ projects = reorder_projects(projects)
+ paginate(projects)
+ end
+
def present_groups(params, groups)
options = {
with: Entities::Group,
@@ -170,11 +177,10 @@ module API
use :pagination
end
get ":id/projects" do
- group = find_group!(params[:id])
- projects = GroupProjectsFinder.new(group: group, current_user: current_user, params: project_finder_params).execute
- projects = reorder_projects(projects)
+ projects = find_group_projects(params)
entity = params[:simple] ? Entities::BasicProjectDetails : Entities::Project
- present paginate(projects), with: entity, current_user: current_user
+
+ present entity.prepare_relation(projects), with: entity, current_user: current_user
end
desc 'Get a list of subgroups in this group.' do