Commit 1309632c authored by Sean McGivern's avatar Sean McGivern

Show group milestones in autocomplete

parent 2ac212a8
......@@ -5,7 +5,15 @@ module Projects
end
def milestones
@project.milestones.active.reorder(due_date: :asc, title: :asc).select([:iid, :title])
finder_params = {
project_ids: [@project.id],
state: :active,
order: { due_date: :asc, title: :asc }
}
finder_params[:group_ids] = [@project.group.id] if @project.group
MilestonesFinder.new(finder_params).execute.select([:iid, :title])
end
def merge_requests
......
---
title: Support Markdown references, autocomplete, and quick actions for group milestones
merge_request:
author:
......@@ -96,4 +96,5 @@ Burndown charts are only available for project milestones currently. They will b
## Quick actions
[Quick actions](../quick_actions.md) are available for assigning and removing project milestones only. [In the future](https://gitlab.com/gitlab-org/gitlab-ce/issues/34778), this will also apply to group milestones.
[Quick actions](../quick_actions.md) are available for assigning and removing
project and group milestones.
......@@ -88,4 +88,31 @@ describe Projects::AutocompleteService do
end
end
end
describe '#milestones' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, group: group) }
let!(:group_milestone) { create(:milestone, group: group) }
let!(:project_milestone) { create(:milestone, project: project) }
let(:milestone_titles) { described_class.new(project, user).milestones.map(&:title) }
it 'includes project and group milestones' do
expect(milestone_titles).to eq([group_milestone.title, project_milestone.title])
end
it 'does not include closed milestones' do
group_milestone.close
expect(milestone_titles).to eq([project_milestone.title])
end
it 'does not include milestones from other projects in the group' do
other_project = create(:project, group: group)
project_milestone.update!(project: other_project)
expect(milestone_titles).to eq([group_milestone.title])
end
end
end
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