Commit 0ab32aaf authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '36205-issues-in-group-milestones' into 'master'

Retrieve issues from subgroups when rendering group milestone

See merge request gitlab-org/gitlab!21024
parents 83d2d09f d16d2582
......@@ -341,6 +341,6 @@ class Milestone < ApplicationRecord
end
def issues_finder_params
{ project_id: project_id, group_id: group_id }.compact
{ project_id: project_id, group_id: group_id, include_subgroups: group_id.present? }.compact
end
end
---
title: Retrieve issues from subgroups when rendering group milestone
merge_request: 21024
author:
type: fixed
......@@ -192,6 +192,23 @@ describe Milestone, 'Milestoneish' do
end
end
end
context 'when milestone is at parent level group' do
let(:parent_group) { create(:group) }
let(:group) { create(:group, parent: parent_group) }
let(:project) { create(:project, namespace: group) }
let(:milestone) { create(:milestone, group: parent_group) }
it 'does not return any merge request for a non member' do
merge_requests = milestone.merge_requests_visible_to_user(non_member)
expect(merge_requests).to be_empty
end
it 'returns milestone merge requests for a member' do
merge_requests = milestone.merge_requests_visible_to_user(member)
expect(merge_requests).to contain_exactly(merge_request)
end
end
end
describe '#complete?' do
......
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