diff options
author | Jarka Kadlecová <jarka@gitlab.com> | 2018-06-01 09:52:55 +0200 |
---|---|---|
committer | Jarka Kadlecová <jarka@gitlab.com> | 2018-06-04 18:25:30 +0200 |
commit | 6426b507244b7f1cec4a7308ab29978d20c8ec98 (patch) | |
tree | 8d8ef447900e6b211119cfa44ef86f5b5428e363 /app/controllers/projects/milestones_controller.rb | |
parent | 50fda506e3bc93af47c8ebcbfc7d38c7ae55467d (diff) | |
download | gitlab-ce-6426b507244b7f1cec4a7308ab29978d20c8ec98.tar.gz |
Include all ancestors milestones in json list & autocomplete36862-subgroup-milestones
Diffstat (limited to 'app/controllers/projects/milestones_controller.rb')
-rw-r--r-- | app/controllers/projects/milestones_controller.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/controllers/projects/milestones_controller.rb b/app/controllers/projects/milestones_controller.rb index c5a044541f1..2494b56981d 100644 --- a/app/controllers/projects/milestones_controller.rb +++ b/app/controllers/projects/milestones_controller.rb @@ -1,4 +1,5 @@ class Projects::MilestonesController < Projects::ApplicationController + include Gitlab::Utils::StrongMemoize include MilestoneActions before_action :check_issuables_available! @@ -103,7 +104,7 @@ class Projects::MilestonesController < Projects::ApplicationController protected def milestones - @milestones ||= begin + strong_memoize(:milestones) do MilestonesFinder.new(search_params).execute end end @@ -121,10 +122,10 @@ class Projects::MilestonesController < Projects::ApplicationController end def search_params - if @project.group && can?(current_user, :read_group, @project.group) - group = @project.group + if request.format.json? && @project.group && can?(current_user, :read_group, @project.group) + groups = @project.group.self_and_ancestors end - params.permit(:state).merge(project_ids: @project.id, group_ids: group&.id) + params.permit(:state).merge(project_ids: @project.id, group_ids: groups&.select(:id)) end end |