This repository was archived by the owner on Mar 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,12 +17,16 @@ def update
1717 value = params [ :hackathon_config ] [ key ]
1818 value = true if value == "true"
1919 value = false if value == "false"
20- if @config . value != value
21- @config . value = value
22- @config . save
23- redirect_to manage_configs_path , notice : "Config \" #{ key } \" has been updated."
24- else
20+ if @config . var . end_with? ( "_asset" ) && !value . start_with? ( 'http://' , 'https://' )
2521 redirect_to manage_configs_path , notice : "Config \" #{ key } \" was not changed"
22+ else
23+ if @config . value != value
24+ @config . value = value
25+ @config . save
26+ redirect_to manage_configs_path , notice : "Config \" #{ key } \" has been updated."
27+ else
28+ redirect_to manage_configs_path , notice : "Config \" #{ key } \" was not changed"
29+ end
2630 end
2731 end
2832
Original file line number Diff line number Diff line change @@ -115,6 +115,18 @@ class Manage::ConfigsControllerTest < ActionController::TestCase
115115 assert_redirected_to manage_configs_path
116116 end
117117
118+ should "update logo_asset with a url" do
119+ HackathonConfig [ "logo_asset" ] = ''
120+ patch :update , params : { id : "logo_asset" , hackathon_config : { logo_asset : "https://picsum.photos/200" } }
121+ assert_equal "https://picsum.photos/200" , HackathonConfig [ "logo_asset" ]
122+ end
123+
124+ should "update logo_asset with an asset that is not URL based" do
125+ HackathonConfig [ "logo_asset" ] = ''
126+ patch :update , params : { id : "logo_asset" , hackathon_config : { logo_asset : "test" } }
127+ assert_equal '' , HackathonConfig [ "logo_asset" ]
128+ end
129+
118130 should "update config CSS variables when custom_css is blank" do
119131 HackathonConfig [ "custom_css" ] = ""
120132 patch :update , params : { id : "custom_css" , hackathon_config : { custom_css : ":root {\n --foo: #fff;\n }" } }
You can’t perform that action at this time.
0 commit comments