summaryrefslogtreecommitdiff
path: root/app/helpers/visibility_level_helper.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/helpers/visibility_level_helper.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/helpers/visibility_level_helper.rb')
-rw-r--r--app/helpers/visibility_level_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb
index d62839cf037..304b58d232a 100644
--- a/app/helpers/visibility_level_helper.rb
+++ b/app/helpers/visibility_level_helper.rb
@@ -167,6 +167,17 @@ module VisibilityLevelHelper
[requested_level, max_allowed_visibility_level(form_model)].min
end
+ def available_visibility_levels(form_model)
+ Gitlab::VisibilityLevel.values.reject do |level|
+ disallowed_visibility_level?(form_model, level) ||
+ restricted_visibility_levels.include?(level)
+ end
+ end
+
+ def snippets_selected_visibility_level(visibility_levels, selected)
+ visibility_levels.find { |level| level == selected } || visibility_levels.min
+ end
+
def multiple_visibility_levels_restricted?
restricted_visibility_levels.many? # rubocop: disable CodeReuse/ActiveRecord
end