Commit 74b6309f authored by Peter Leitzen's avatar Peter Leitzen

Do not apply SLA labels when issuable does not support it

parent bb9ef246
...@@ -9,9 +9,10 @@ module IncidentManagement ...@@ -9,9 +9,10 @@ module IncidentManagement
def perform(incident_id) def perform(incident_id)
@incident = Issue.find_by_id(incident_id) @incident = Issue.find_by_id(incident_id)
@project = incident&.project return unless incident&.supports_severity?
return unless incident && project @project = incident&.project
return unless project
@label = incident_exceeded_sla_label @label = incident_exceeded_sla_label
return if incident.label_ids.include?(label.id) return if incident.label_ids.include?(label.id)
......
...@@ -39,4 +39,15 @@ RSpec.describe IncidentManagement::ApplyIncidentSlaExceededLabelWorker do ...@@ -39,4 +39,15 @@ RSpec.describe IncidentManagement::ApplyIncidentSlaExceededLabelWorker do
expect(event.action).to eq('add') expect(event.action).to eq('add')
expect(event.label).to eq(label) expect(event.label).to eq(label)
end end
context 'for plain issues' do
before_all do
incident.update!(issue_type: 'issue')
end
it 'does not add a label', :aggregate_failures do
expect { subject }.not_to change { incident.labels.reload.count }
expect(incident.labels.reload).to be_empty
end
end
end end
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