diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-28 21:09:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-28 21:09:03 +0300 |
commit | b420660ef1369fec4d09b7bf5e961d81980974e5 (patch) | |
tree | f096fdd1bd3b4898e1b2ca80957ce68c200c09f0 /lib/gitlab/visibility_level.rb | |
parent | b8026fd558e7ec154c626208a33c1485aec8f4ea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/visibility_level.rb')
-rw-r--r-- | lib/gitlab/visibility_level.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb index d378e558b8a..049e3befe64 100644 --- a/lib/gitlab/visibility_level.rb +++ b/lib/gitlab/visibility_level.rb @@ -18,6 +18,8 @@ module Gitlab scope :public_to_user, -> (user = nil) do where(visibility_level: VisibilityLevel.levels_for_user(user)) end + + alias_method :visibility_level=, :visibility= end PRIVATE = 0 unless const_defined?(:PRIVATE) @@ -108,10 +110,10 @@ module Gitlab options.key(level.to_i) || s_('VisibilityLevel|Unknown') end - def level_value(level) + def level_value(level, fallback_value: PRIVATE) return level.to_i if level.to_i.to_s == level.to_s && string_options.key(level.to_i) - string_options[level] || PRIVATE + string_options[level] || fallback_value end def string_level(level) |