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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 21:09:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 21:09:06 +0300
commitb042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (patch)
treede31671ab7c6ca8c2a3721cbabd1f2a42b3d0194 /app/services/projects
parenteabf8fd774fef6a54903e5141138f47bdafeb331 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/operations/update_service.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/services/projects/operations/update_service.rb b/app/services/projects/operations/update_service.rb
index 706a6f01a75..3ee6c2467c2 100644
--- a/app/services/projects/operations/update_service.rb
+++ b/app/services/projects/operations/update_service.rb
@@ -30,6 +30,27 @@ module Projects
settings = params[:error_tracking_setting_attributes]
return {} if settings.blank?
+ if error_tracking_params_partial_updates?(settings)
+ error_tracking_params_for_partial_update(settings)
+ else
+ error_tracking_params_for_update(settings)
+ end
+ end
+
+ def error_tracking_params_partial_updates?(settings)
+ # Help from @splattael :bow:
+ # Make sure we're converting to symbols because
+ # * ActionController::Parameters#keys returns a list of strings
+ # * in specs we're using hashes with symbols as keys
+
+ settings.keys.map(&:to_sym) == %i[enabled]
+ end
+
+ def error_tracking_params_for_partial_update(settings)
+ { error_tracking_setting_attributes: settings }
+ end
+
+ def error_tracking_params_for_update(settings)
api_url = ::ErrorTracking::ProjectErrorTrackingSetting.build_api_url_from(
api_host: settings[:api_host],
project_slug: settings.dig(:project, :slug),