Fix GFM reference links for closed milestones

parent df7eaa85
---
title: Fix GFM reference links for closed milestones
merge_request: 15234
author: Vitaliy @blackst0ne Klachkov
type: fixed
......@@ -56,7 +56,7 @@ module Banzai
end
def find_milestone_with_finder(project, params)
finder_params = { project_ids: [project.id], order: nil }
finder_params = { project_ids: [project.id], order: nil, state: 'all' }
# We don't support IID lookups for group milestones, because IIDs can
# clash between group and project milestones.
......
......@@ -294,8 +294,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do
end
end
context 'project milestones' do
let(:milestone) { create(:milestone, project: project) }
shared_context 'project milestones' do
let(:reference) { milestone.to_reference(format: :iid) }
include_examples 'reference parsing'
......@@ -309,8 +308,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do
it_behaves_like 'cross project shorthand reference'
end
context 'group milestones' do
let(:milestone) { create(:milestone, group: group) }
shared_context 'group milestones' do
let(:reference) { milestone.to_reference(format: :name) }
include_examples 'reference parsing'
......@@ -354,4 +352,32 @@ describe Banzai::Filter::MilestoneReferenceFilter do
expect(result.css('a').first.attr('href')).to eq(urls.milestone_url(milestone))
end
end
context 'when milestone is open' do
context 'project milestones' do
let(:milestone) { create(:milestone, project: project) }
include_context 'project milestones'
end
context 'group milestones' do
let(:milestone) { create(:milestone, group: group) }
include_context 'group milestones'
end
end
context 'when milestone is closed' do
context 'project milestones' do
let(:milestone) { create(:milestone, :closed, project: project) }
include_context 'project milestones'
end
context 'group milestones' do
let(:milestone) { create(:milestone, :closed, group: group) }
include_context 'group milestones'
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