Commit e2d263ae authored by Sean McGivern's avatar Sean McGivern

Merge branch '4069-epic-subgroup-issues' into 'master'

Fix linking issues from subgroups to epics in parent group

Closes #4069

See merge request gitlab-org/gitlab-ee!3445
parents eaeed2d6 5b1504d2
...@@ -19,7 +19,11 @@ module EpicIssues ...@@ -19,7 +19,11 @@ module EpicIssues
def linkable_issues(issues) def linkable_issues(issues)
return [] unless can?(current_user, :admin_epic, issuable.group) return [] unless can?(current_user, :admin_epic, issuable.group)
issues.select { |issue| issue.project.group == issuable.group } issues.select { |issue| issuable_group_descendants.include?(issue.project.group) }
end
def issuable_group_descendants
@descendants ||= issuable.group.self_and_descendants
end end
end end
end end
...@@ -88,7 +88,17 @@ describe EpicIssues::CreateService do ...@@ -88,7 +88,17 @@ describe EpicIssues::CreateService do
end end
end end
context 'when an issue links is given' do context 'when an issue link is given' do
subject { assign_issue([IssuesHelper.url_for_issue(issue.iid, issue.project)]) }
include_examples 'returns success'
end
context 'when a link of an issue in a subgroup is given', :nested_groups do
let(:subgroup) { create(:group, parent: group) }
let(:project2) { create(:project, group: subgroup) }
let(:issue) { create(:issue, project: project2) }
subject { assign_issue([IssuesHelper.url_for_issue(issue.iid, issue.project)]) } subject { assign_issue([IssuesHelper.url_for_issue(issue.iid, issue.project)]) }
include_examples 'returns success' include_examples 'returns success'
......
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