diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 09:08:49 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 09:08:49 +0000 |
commit | 46b10c0fc884400941c17e2777b242ac54d111e5 (patch) | |
tree | 184bc49764f03791610c8ae716c03e0100ed45f5 /app/controllers | |
parent | 3358e1fdb8fe1e8f739024ee4f3d1071b296a010 (diff) | |
download | gitlab-ce-46b10c0fc884400941c17e2777b242ac54d111e5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/groups/application_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/groups/milestones_controller.rb | 13 |
2 files changed, 18 insertions, 3 deletions
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 |