Commit 61b775ed authored by Sean McGivern's avatar Sean McGivern

Merge branch 'bugfix_banzai_closed_milestones' into 'master'

Fix GFM reference links for closed milestones

Closes #39850

See merge request gitlab-org/gitlab-ce!15234
parents 5bfb5790 c9659d4c
---
title: Fix GFM reference links for closed milestones
merge_request: 15234
author: Vitaliy @blackst0ne Klachkov
type: fixed
...@@ -56,7 +56,7 @@ module Banzai ...@@ -56,7 +56,7 @@ module Banzai
end end
def find_milestone_with_finder(project, params) 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 # We don't support IID lookups for group milestones, because IIDs can
# clash between group and project milestones. # clash between group and project milestones.
......
...@@ -294,8 +294,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do ...@@ -294,8 +294,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do
end end
end end
context 'project milestones' do shared_context 'project milestones' do
let(:milestone) { create(:milestone, project: project) }
let(:reference) { milestone.to_reference(format: :iid) } let(:reference) { milestone.to_reference(format: :iid) }
include_examples 'reference parsing' include_examples 'reference parsing'
...@@ -309,8 +308,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do ...@@ -309,8 +308,7 @@ describe Banzai::Filter::MilestoneReferenceFilter do
it_behaves_like 'cross project shorthand reference' it_behaves_like 'cross project shorthand reference'
end end
context 'group milestones' do shared_context 'group milestones' do
let(:milestone) { create(:milestone, group: group) }
let(:reference) { milestone.to_reference(format: :name) } let(:reference) { milestone.to_reference(format: :name) }
include_examples 'reference parsing' include_examples 'reference parsing'
...@@ -354,4 +352,32 @@ describe Banzai::Filter::MilestoneReferenceFilter do ...@@ -354,4 +352,32 @@ describe Banzai::Filter::MilestoneReferenceFilter do
expect(result.css('a').first.attr('href')).to eq(urls.milestone_url(milestone)) expect(result.css('a').first.attr('href')).to eq(urls.milestone_url(milestone))
end end
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 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