Commit e244e7fd authored by Peter Leitzen's avatar Peter Leitzen

Prevent issuable which don't support epics from being linked to epics

For example, incidents should be linked to epics.
parent da1dab64
......@@ -50,7 +50,9 @@ module EpicIssues
return [] unless can?(current_user, :admin_epic, issuable.group)
issues.select do |issue|
issuable_group_descendants.include?(issue.project.group) && !previous_related_issuables.include?(issue)
issue.supports_epic? &&
issuable_group_descendants.include?(issue.project.group) &&
!previous_related_issuables.include?(issue)
end
end
end
......
......@@ -232,6 +232,14 @@ RSpec.describe EpicIssues::CreateService do
)
end
end
context "when assigning issuable which don't support epics" do
let_it_be(:incident) { create(:incident, project: project) }
subject { assign_issue([incident.to_reference(full: true)]) }
include_examples 'returns an error'
end
end
context 'when user does not have permissions to link the issue' 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