From 2ec2a906b552d5f4a486130b88a39a4a14e7b28f Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Fri, 26 Oct 2018 14:02:20 +0800 Subject: Add group projects API options for including shared and subgroups --- lib/api/groups.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/api/groups.rb b/lib/api/groups.rb index 64b998ab455..12227c886b2 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -60,7 +60,17 @@ module API def find_group_projects(params) group = find_group!(params[:id]) - projects = GroupProjectsFinder.new(group: group, current_user: current_user, params: project_finder_params).execute + options = { + only_owned: !params[:include_shared], + include_subgroups: params[:include_subgroups] + } + + projects = GroupProjectsFinder.new( + group: group, + current_user: current_user, + params: project_finder_params, + options: options + ).execute projects = projects.with_issues_available_for_user(current_user) if params[:with_issues_enabled] projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled] projects = reorder_projects(projects) @@ -201,6 +211,8 @@ module API optional :starred, type: Boolean, default: false, desc: 'Limit by starred status' optional :with_issues_enabled, type: Boolean, default: false, desc: 'Limit by enabled issues feature' optional :with_merge_requests_enabled, type: Boolean, default: false, desc: 'Limit by enabled merge requests feature' + optional :include_subgroups, type: Boolean, default: false, desc: 'Includes projects in subgroups of this group' + optional :include_shared, type: Boolean, default: true, desc: 'Include projects shared to this group' use :pagination use :with_custom_attributes -- cgit v1.2.1