Commit 019c882b authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix milestone quick action

Handles ancestor group milestones by passing in the ancestor group ids
to MilestonesFinder
parent bff2d1b3
......@@ -84,7 +84,9 @@ module QuickActions
# rubocop: enable CodeReuse/ActiveRecord
def find_milestones(project, params = {})
MilestonesFinder.new(params.merge(project_ids: [project.id], group_ids: [project.group&.id])).execute
group_ids = project.group.self_and_ancestors.select(:id) if project.group
MilestonesFinder.new(params.merge(project_ids: [project.id], group_ids: group_ids)).execute
end
def parent
......
---
title: Fix milestone quick action to handle ancestor group milestones
merge_request: 22231
author:
type: fixed
......@@ -856,9 +856,10 @@ describe QuickActions::InterpretService do
end
context 'only group milestones available' do
let(:group) { create(:group) }
let(:ancestor_group) { create(:group) }
let(:group) { create(:group, parent: ancestor_group) }
let(:project) { create(:project, :public, namespace: group) }
let(:milestone) { create(:milestone, group: group, title: '10.0') }
let(:milestone) { create(:milestone, group: ancestor_group, title: '10.0') }
it_behaves_like 'milestone command' do
let(:content) { "/milestone %#{milestone.title}" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment