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
This commit is contained in:
Sean McGivern 2017-11-07 09:11:51 +00:00
commit 61b775edcc
3 changed files with 36 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
title: Fix GFM reference links for closed milestones
merge_request: 15234
author: Vitaliy @blackst0ne Klachkov
type: fixed

View file

@ -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.

View file

@ -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