diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-18 15:10:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-18 15:10:41 +0300 |
commit | f23a9a17ed6237c346d2e9210c6841e319e8d030 (patch) | |
tree | 7b46c0ff193c445f35774a86ec3d0ff000d2ff77 /app/services/alert_management | |
parent | d7432b66ff241af3f39d82da581832a084983378 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/alert_management')
-rw-r--r-- | app/services/alert_management/http_integrations/create_service.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/services/alert_management/http_integrations/create_service.rb b/app/services/alert_management/http_integrations/create_service.rb index 576e38c23aa..e7f1084ce5c 100644 --- a/app/services/alert_management/http_integrations/create_service.rb +++ b/app/services/alert_management/http_integrations/create_service.rb @@ -9,14 +9,14 @@ module AlertManagement def initialize(project, current_user, params) @project = project @current_user = current_user - @params = params + @params = params.with_indifferent_access end def execute return error_no_permissions unless allowed? return error_multiple_integrations unless creation_allowed? - integration = project.alert_management_http_integrations.create(params) + integration = project.alert_management_http_integrations.create(permitted_params) return error_in_create(integration) unless integration.valid? success(integration) @@ -34,6 +34,15 @@ module AlertManagement project.alert_management_http_integrations.empty? end + def permitted_params + params.slice(*permitted_params_keys) + end + + # overriden in EE + def permitted_params_keys + %i[name active] + end + def error(message) ServiceResponse.error(message: message) end |