Commit c68b31bf authored by Spencer Phillip Young's avatar Spencer Phillip Young Committed by Michael Kozono

Only update required instance CI template when the parameter is present

Changelog: fixed
parent ee5bcb32
...@@ -208,7 +208,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -208,7 +208,10 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params[:application_setting][:import_sources]&.delete("") params[:application_setting][:import_sources]&.delete("")
params[:application_setting][:restricted_visibility_levels]&.delete("") params[:application_setting][:restricted_visibility_levels]&.delete("")
params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].blank?
if params[:application_setting].key?(:required_instance_ci_template)
params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].empty?
end
remove_blank_params_for!(:elasticsearch_aws_secret_access_key, :eks_secret_access_key) remove_blank_params_for!(:elasticsearch_aws_secret_access_key, :eks_secret_access_key)
...@@ -217,9 +220,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -217,9 +220,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params.delete(:domain_denylist_raw) if params[:domain_denylist] params.delete(:domain_denylist_raw) if params[:domain_denylist]
params.delete(:domain_allowlist_raw) if params[:domain_allowlist] params.delete(:domain_allowlist_raw) if params[:domain_allowlist]
params.require(:application_setting).permit( params[:application_setting].permit(visible_application_setting_attributes)
visible_application_setting_attributes
)
end end
def recheck_user_consent? def recheck_user_consent?
......
...@@ -194,6 +194,14 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -194,6 +194,14 @@ RSpec.describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.required_instance_ci_template).to be_nil expect(ApplicationSetting.current.required_instance_ci_template).to be_nil
end end
end end
context 'without key' do
it 'does not set required_instance_ci_template to nil' do
put :update, params: { application_setting: {} }
expect(ApplicationSetting.current.required_instance_ci_template).to be == 'Auto-DevOps'
end
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment