Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/operations/update_service.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/services/projects/operations/update_service.rb b/app/services/projects/operations/update_service.rb
index 27bbf5c6e57..c06f572b52f 100644
--- a/app/services/projects/operations/update_service.rb
+++ b/app/services/projects/operations/update_service.rb
@@ -13,12 +13,30 @@ module Projects
def project_update_params
error_tracking_params
+ .merge(alerting_setting_params)
.merge(metrics_setting_params)
.merge(grafana_integration_params)
.merge(prometheus_integration_params)
.merge(incident_management_setting_params)
end
+ def alerting_setting_params
+ return {} unless can?(current_user, :read_prometheus_alerts, project)
+
+ attr = params[:alerting_setting_attributes]
+ return {} unless attr
+
+ regenerate_token = attr.delete(:regenerate_token)
+
+ if regenerate_token
+ attr[:token] = nil
+ else
+ attr = attr.except(:token)
+ end
+
+ { alerting_setting_attributes: attr }
+ end
+
def metrics_setting_params
attribs = params[:metrics_setting_attributes]
return {} unless attribs