summaryrefslogtreecommitdiff
path: root/lib/api/settings.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-02 09:22:44 +0100
committerToon Claes <toon@gitlab.com>2017-03-02 16:31:22 +0100
commitc3b1cb71f0726bd9cd3916507337650e6546141f (patch)
treed5076999de9f53bf25c9a5a4e4af69c3d524bd83 /lib/api/settings.rb
parenta3fdd6acd27f5aa98f13e7a0083d0c3208003ccb (diff)
downloadgitlab-ce-c3b1cb71f0726bd9cd3916507337650e6546141f.tar.gz
Override setters so it also accepts string visibility levels27501-api-use-visibility-everywhere
Override the `ApplicationSetting` default visibility_level setters so they accept strings & integers for the levels.
Diffstat (limited to 'lib/api/settings.rb')
-rw-r--r--lib/api/settings.rb16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/api/settings.rb b/lib/api/settings.rb
index fef21f86f8c..d4d3229f0d1 100644
--- a/lib/api/settings.rb
+++ b/lib/api/settings.rb
@@ -7,20 +7,6 @@ module API
@current_setting ||=
(ApplicationSetting.current || ApplicationSetting.create_from_defaults)
end
-
- def map_setting_visibility_levels(attrs)
- [:default_project_visibility, :default_snippet_visibility, :default_group_visibility].each do |param|
- visibility = attrs.delete(param)
- if visibility
- attrs[param] = Gitlab::VisibilityLevel.string_options[visibility]
- end
- end
- restricted_levels = attrs.delete(:restricted_visibility_levels)
- if restricted_levels
- attrs[:restricted_visibility_levels] = Gitlab::VisibilityLevel.string_options.values_at(*restricted_levels)
- end
- attrs
- end
end
desc 'Get the current application settings' do
@@ -142,7 +128,7 @@ module API
:housekeeping_enabled, :terminal_max_session_time
end
put "application/settings" do
- attrs = map_setting_visibility_levels(declared_params(include_missing: false))
+ attrs = declared_params(include_missing: false)
if current_settings.update_attributes(attrs)
present current_settings, with: Entities::ApplicationSetting