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/application_settings/update_service.rb')
-rw-r--r--app/services/application_settings/update_service.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/services/application_settings/update_service.rb b/app/services/application_settings/update_service.rb
index 7728982779e..6d484c4fa22 100644
--- a/app/services/application_settings/update_service.rb
+++ b/app/services/application_settings/update_service.rb
@@ -26,6 +26,7 @@ module ApplicationSettings
end
update_terms(@params.delete(:terms))
+ update_default_branch_protection_defaults(@params[:default_branch_protection])
add_to_outbound_local_requests_whitelist(@params.delete(:add_to_outbound_local_requests_whitelist))
@@ -77,6 +78,19 @@ module ApplicationSettings
@application_setting.reset_memoized_terms
end
+ def update_default_branch_protection_defaults(default_branch_protection)
+ return unless default_branch_protection.present?
+
+ # We are migrating default_branch_protection from an integer
+ # column to a jsonb column. While completing the rest of the
+ # work, we want to start translating the updates sent to the
+ # existing column into the json. Eventually, we will be updating
+ # the jsonb column directly and deprecating the original update
+ # path. Until then, we want to sync up both columns.
+ protection = Gitlab::Access::BranchProtection.new(default_branch_protection.to_i)
+ @application_setting.default_branch_protection_defaults = protection.to_hash
+ end
+
def process_performance_bar_allowed_group_id
group_full_path = params.delete(:performance_bar_allowed_group_path)
enable_param_on = Gitlab::Utils.to_boolean(params.delete(:performance_bar_enabled))