Commit 22113004 authored by Jarka Košanová's avatar Jarka Košanová

Include subepics in IssuesFinder if requested

parent 64c36629
......@@ -87,13 +87,21 @@ module EE
params[:epic_id].to_s.downcase == ::IssuesFinder::FILTER_NONE
end
def epics
if params[:include_subepics]
::Gitlab::ObjectHierarchy.new(::Epic.for_ids(params[:epic_id])).base_and_descendants.select(:id)
else
params[:epic_id]
end
end
def by_epic(items)
return items unless by_epic?
if filter_by_no_epic?
items.no_epic
else
items.in_epics(params[:epic_id])
items.in_epics(epics)
end
end
end
......
......@@ -97,8 +97,20 @@ describe IssuesFinder do
context 'filter issues by epic' do
let(:params) { { epic_id: epic_1.id } }
it 'returns all issues in the epic, subepic issues excluded' do
expect(issues).to contain_exactly(issue_1)
context 'when include_subepics param is not included' do
it 'returns all issues in the epic, subepic issues excluded' do
expect(issues).to contain_exactly(issue_1)
end
end
context 'when include_subepics param is set to true' do
before do
params[:include_subepics] = true
end
it 'returns all issues in the epic including subepic issues' do
expect(issues).to contain_exactly(issue_1, issue_subepic)
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