diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-17 16:57:09 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-04-19 12:22:19 +0300 |
commit | a5ffb991e4cd847b5b789bfe2b9c3c1d6b70e5c7 (patch) | |
tree | 61944e2d7912810a98cb8a97613d60bd050f92d6 /app | |
parent | 3dc311acf701c599eb8dc5dcb8d6fffeb02b9745 (diff) |
Merge branch 'fix/project-visibility-setting' into 'master'
Fix restricted visibility project setting
Closes #30581
See merge request !10622
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/projects_helper.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 6b9e4267281..43669b6f356 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -24,7 +24,7 @@ module ProjectsHelper return "(deleted)" unless author - author_html = "" + author_html = "" # Build avatar image tag author_html << image_tag(avatar_icon(author, opts[:size]), width: opts[:size], class: "avatar avatar-inline #{"s#{opts[:size]}" if opts[:size]} #{opts[:avatar_class] if opts[:avatar_class]}", alt: '') if opts[:avatar] @@ -45,7 +45,7 @@ module ProjectsHelper link_to(author_html, user_path(author), class: "author_link #{"#{opts[:extra_class]}" if opts[:extra_class]} #{"#{opts[:mobile_classes]}" if opts[:mobile_classes]}").html_safe else title = opts[:title].sub(":name", sanitize(author.name)) - link_to(author_html, user_path(author), class: "author_link has-tooltip", title: title, data: { container: 'body' } ).html_safe + link_to(author_html, user_path(author), class: "author_link has-tooltip", title: title, data: { container: 'body' }).html_safe end end @@ -430,13 +430,22 @@ module ProjectsHelper end def visibility_select_options(project, selected_level) - levels_options_array = Gitlab::VisibilityLevel.values.map do |level| - [ + level_options = Gitlab::VisibilityLevel.values.each_with_object([]) do |level, level_options| + next if restricted_levels.include?(level) + + level_options << [ visibility_level_label(level), { data: { description: visibility_level_description(level, project) } }, level ] end - options_for_select(levels_options_array, selected_level) + + options_for_select(level_options, selected_level) + end + + def restricted_levels + return [] if current_user.admin? + + current_application_settings.restricted_visibility_levels || [] end end |