diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-01 21:07:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-01 21:07:29 +0300 |
commit | ed323a3c6fcc2927e217b72121875abd448c2785 (patch) | |
tree | fa9ec07b438884c641640ffa97c61e1339b9a9da /app/services/incident_management | |
parent | 04e74bf311de04c1334343a35fe9954953c6413d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/incident_management')
-rw-r--r-- | app/services/incident_management/incidents/create_service.rb | 9 | ||||
-rw-r--r-- | app/services/incident_management/incidents/update_severity_service.rb | 38 |
2 files changed, 2 insertions, 45 deletions
diff --git a/app/services/incident_management/incidents/create_service.rb b/app/services/incident_management/incidents/create_service.rb index 5d92a33eb2b..f8437290d9b 100644 --- a/app/services/incident_management/incidents/create_service.rb +++ b/app/services/incident_management/incidents/create_service.rb @@ -20,15 +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 @@ -43,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 |