diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/services/incident_management/incidents | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/services/incident_management/incidents')
-rw-r--r-- | app/services/incident_management/incidents/create_service.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/app/services/incident_management/incidents/create_service.rb b/app/services/incident_management/incidents/create_service.rb index 7206eaf51b2..5b925e0f440 100644 --- a/app/services/incident_management/incidents/create_service.rb +++ b/app/services/incident_management/incidents/create_service.rb @@ -5,11 +5,12 @@ module IncidentManagement class CreateService < BaseService ISSUE_TYPE = 'incident' - def initialize(project, current_user, title:, description:) + def initialize(project, current_user, title:, description:, severity: IssuableSeverity::DEFAULT) super(project, current_user) @title = title @description = description + @severity = severity end def execute @@ -18,25 +19,19 @@ module IncidentManagement current_user, title: title, description: description, - label_ids: [find_or_create_incident_label.id], issue_type: ISSUE_TYPE ).execute return error(issue.errors.full_messages.to_sentence, issue) unless issue.valid? + issue.update_severity(severity) + success(issue) end private - attr_reader :title, :description - - def find_or_create_incident_label - IncidentManagement::CreateIncidentLabelService - .new(project, current_user) - .execute - .payload[:label] - end + attr_reader :title, :description, :severity def success(issue) ServiceResponse.success(payload: { issue: issue }) |