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:
authorToon Claes <toon@gitlab.com>2017-03-21 00:05:53 +0300
committerToon Claes <toon@gitlab.com>2017-03-21 00:53:29 +0300
commit71306f14f69b9798a21905cfa8160c4990ca5d5d (patch)
tree007e5b27082767b6c75eab003a610c28597d7efd /lib/gitlab/visibility_level.rb
parentdd3d62b626f97800e9e72834455def675a879528 (diff)
Make level_value accept string integers
When a VisibilityLevel is an integer formatted as a string, convert it to an integer, instead of looking it up in the hash map. When the value is not recognized, default to PRIVATE.
Diffstat (limited to 'lib/gitlab/visibility_level.rb')
-rw-r--r--lib/gitlab/visibility_level.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index 2248763c106..8f1d1fdc02e 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -96,8 +96,8 @@ module Gitlab
end
def level_value(level)
- return string_options[level] if level.is_a? String
- level
+ return level.to_i if level.to_i.to_s == level.to_s && string_options.key(level.to_i)
+ string_options[level] || PRIVATE
end
def string_level(level)