Commit ba234544 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'pl-incidents-unlinkable-in-epics' into 'master'

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

See merge request gitlab-org/gitlab!40501
parents 59c3c3b8 e244e7fd
...@@ -50,7 +50,9 @@ module EpicIssues ...@@ -50,7 +50,9 @@ module EpicIssues
return [] unless can?(current_user, :admin_epic, issuable.group) return [] unless can?(current_user, :admin_epic, issuable.group)
issues.select do |issue| 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 end
end end
......
...@@ -232,6 +232,14 @@ RSpec.describe EpicIssues::CreateService do ...@@ -232,6 +232,14 @@ RSpec.describe EpicIssues::CreateService do
) )
end end
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 end
context 'when user does not have permissions to link the issue' do 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