Commit 5b1504d2 authored by Jarka Kadlecova's avatar Jarka Kadlecova

Fix linking issues from subgroups to epics in parent group

parent e985161a
......@@ -19,7 +19,11 @@ module EpicIssues
def linkable_issues(issues)
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
......@@ -88,7 +88,17 @@ describe EpicIssues::CreateService do
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)]) }
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