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:
authorVinnie Okada <vincent@gitlab.com>2015-03-16 22:59:50 +0300
committerVinnie Okada <vincent@gitlab.com>2015-03-16 22:59:50 +0300
commit2e672c39a09577a0a16e75a10a249c923d8ee863 (patch)
tree6a4b5bd872c547432aedae908920f3e7432282b8 /app/models/application_setting.rb
parent7c3c836d3b62c72d1adf5431c0fedc91d92a8907 (diff)
Fix restricted visibility bugs
Check for nil values in the restricted_visibility_level validation method, and set the restricted visibility request parameter to `[]` when it's missing from the request.
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 6abdf0c755a..1c87db613ae 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -27,9 +27,11 @@ class ApplicationSetting < ActiveRecord::Base
if: :home_page_url_column_exist
validates_each :restricted_visibility_levels do |record, attr, value|
- value.each do |level|
- unless Gitlab::VisibilityLevel.options.has_value?(level)
- record.errors.add(attr, "'#{level}' is not a valid visibility level")
+ unless value.nil?
+ value.each do |level|
+ unless Gitlab::VisibilityLevel.options.has_value?(level)
+ record.errors.add(attr, "'#{level}' is not a valid visibility level")
+ end
end
end
end