diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-22 21:11:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-22 21:11:12 +0300 |
commit | 1862f4a83ebb0a08a0da8269c568e1b93f75d55a (patch) | |
tree | bfec3ba41bedd2c138b60fdb5c2cc308932f16ee /app/services/incident_management | |
parent | b6abc9850e69e4e2ab60fa6ababe25da97505edc (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 | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/app/services/incident_management/incidents/create_service.rb b/app/services/incident_management/incidents/create_service.rb index ef66325fdcc..f44842650b7 100644 --- a/app/services/incident_management/incidents/create_service.rb +++ b/app/services/incident_management/incidents/create_service.rb @@ -15,7 +15,7 @@ module IncidentManagement end def execute - issue = Issues::CreateService.new( + create_result = Issues::CreateService.new( project: project, current_user: current_user, params: { @@ -29,22 +29,16 @@ module IncidentManagement ).execute if alert - return error(alert.errors.full_messages.to_sentence, issue) unless alert.valid? + return error(alert.errors.full_messages, create_result[:issue]) unless alert.valid? end - return error(issue.errors.full_messages.to_sentence, issue) unless issue.valid? - - success(issue) + create_result end private attr_reader :title, :description, :severity, :alert - def success(issue) - ServiceResponse.success(payload: { issue: issue }) - end - def error(message, issue = nil) ServiceResponse.error(payload: { issue: issue }, message: message) end |