summaryrefslogtreecommitdiff
path: root/app/services/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
commit5064bf8c5647d4c4430cbb4d097cf1592416de29 (patch)
treed051bf2abe2cc7061b3a7facb6669a56ccb9cf54 /app/services/projects
parent9c83aadd2604e7e6cb1f84683f951e6b12872618 (diff)
downloadgitlab-ce-5064bf8c5647d4c4430cbb4d097cf1592416de29.tar.gz
Add latest changes from gitlab-org/gitlab@master
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