From 46b10c0fc884400941c17e2777b242ac54d111e5 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 29 Jan 2020 09:08:49 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/controllers/groups/application_controller.rb | 8 ++++++++ app/controllers/groups/milestones_controller.rb | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'app/controllers/groups') diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb index d03a50f6f77..0760bdf1e01 100644 --- a/app/controllers/groups/application_controller.rb +++ b/app/controllers/groups/application_controller.rb @@ -20,6 +20,14 @@ class Groups::ApplicationController < ApplicationController @projects ||= GroupProjectsFinder.new(group: group, current_user: current_user).execute end + def group_projects_with_subgroups + @group_projects_with_subgroups ||= GroupProjectsFinder.new( + group: group, + current_user: current_user, + options: { include_subgroups: true } + ).execute + end + def authorize_admin_group! unless can?(current_user, :admin_group, group) return render_404 diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index 7eba73daa3c..a478e9fffb8 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -103,8 +103,15 @@ class Groups::MilestonesController < Groups::ApplicationController end def group_projects_with_access - group_projects.with_issues_available_for_user(current_user) - .or(group_projects.with_merge_requests_available_for_user(current_user)) + group_projects_with_subgroups.with_issues_or_mrs_available_for_user(current_user) + end + + def group_ids(include_ancestors: false) + if include_ancestors + group.self_and_hierarchy.public_or_visible_to_user(current_user).select(:id) + else + group.self_and_descendants.public_or_visible_to_user(current_user).select(:id) + end end def milestone @@ -119,7 +126,7 @@ class Groups::MilestonesController < Groups::ApplicationController end def search_params - groups = request.format.json? ? group.self_and_ancestors.select(:id) : group.id + groups = request.format.json? ? group_ids(include_ancestors: true) : group_ids params.permit(:state, :search_title).merge(group_ids: groups) end -- cgit v1.2.1