Fix Banzai reference for milestones belonging to parent groups
This commit is contained in:
parent
10a190dba2
commit
7530e4ec86
2 changed files with 10 additions and 2 deletions
|
@ -65,7 +65,7 @@ module Banzai
|
|||
# We don't support IID lookups for group milestones, because IIDs can
|
||||
# clash between group and project milestones.
|
||||
if project.group && !params[:iid]
|
||||
finder_params[:group_ids] = [project.group.id]
|
||||
finder_params[:group_ids] = project.group.self_and_ancestors.select(:id)
|
||||
end
|
||||
|
||||
MilestonesFinder.new(finder_params).find_by(params)
|
||||
|
|
|
@ -3,7 +3,8 @@ require 'spec_helper'
|
|||
describe Banzai::Filter::MilestoneReferenceFilter do
|
||||
include FilterSpecHelper
|
||||
|
||||
let(:group) { create(:group, :public) }
|
||||
let(:parent_group) { create(:group, :public) }
|
||||
let(:group) { create(:group, :public, parent: parent_group) }
|
||||
let(:project) { create(:project, :public, group: group) }
|
||||
|
||||
it 'requires project context' do
|
||||
|
@ -340,6 +341,13 @@ describe Banzai::Filter::MilestoneReferenceFilter do
|
|||
|
||||
expect(doc.css('a')).to be_empty
|
||||
end
|
||||
|
||||
it 'supports parent group references', :nested_groups do
|
||||
milestone.update!(group: parent_group)
|
||||
|
||||
doc = reference_filter("See #{reference}")
|
||||
expect(doc.css('a').first.text).to eq(milestone.name)
|
||||
end
|
||||
end
|
||||
|
||||
context 'group context' do
|
||||
|
|
Loading…
Reference in a new issue