diff options
Diffstat (limited to 'app/services/incident_management/incidents')
-rw-r--r-- | app/services/incident_management/incidents/create_service.rb | 12 | ||||
-rw-r--r-- | app/services/incident_management/incidents/update_severity_service.rb | 38 |
2 files changed, 4 insertions, 46 deletions
diff --git a/app/services/incident_management/incidents/create_service.rb b/app/services/incident_management/incidents/create_service.rb index 7497ee00d74..f8437290d9b 100644 --- a/app/services/incident_management/incidents/create_service.rb +++ b/app/services/incident_management/incidents/create_service.rb @@ -20,14 +20,14 @@ module IncidentManagement params: { title: title, description: description, - issue_type: ISSUE_TYPE - } + issue_type: ISSUE_TYPE, + severity: severity + }, + spam_params: nil ).execute return error(issue.errors.full_messages.to_sentence, issue) unless issue.valid? - update_severity_for(issue) - success(issue) end @@ -42,10 +42,6 @@ module IncidentManagement def error(message, issue = nil) ServiceResponse.error(payload: { issue: issue }, message: message) end - - def update_severity_for(issue) - ::IncidentManagement::Incidents::UpdateSeverityService.new(issue, current_user, severity).execute - end end end end diff --git a/app/services/incident_management/incidents/update_severity_service.rb b/app/services/incident_management/incidents/update_severity_service.rb deleted file mode 100644 index faa9277c469..00000000000 --- a/app/services/incident_management/incidents/update_severity_service.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module IncidentManagement - module Incidents - class UpdateSeverityService < BaseService - def initialize(issuable, current_user, severity) - super(issuable.project, current_user) - - @issuable = issuable - @severity = severity.to_s.downcase - @severity = IssuableSeverity::DEFAULT unless IssuableSeverity.severities.key?(@severity) - end - - def execute - return unless issuable.supports_severity? - - update_severity! - add_system_note - end - - private - - attr_reader :issuable, :severity - - def issuable_severity - issuable.issuable_severity || issuable.build_issuable_severity(issue_id: issuable.id) - end - - def update_severity! - issuable_severity.update!(severity: severity) - end - - def add_system_note - ::IncidentManagement::AddSeveritySystemNoteWorker.perform_async(issuable.id, current_user.id) - end - end - end -end |