Commit a4c8afda authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch '46759-ensure-operations-menu-only-visible-if-needed' into 'master'

Resolve "Operations navigation menu renders empty menu when user does not have the right permissions"

Closes #46759

See merge request gitlab-org/gitlab-ce!19198
parents 79251271 7a0f15e2
...@@ -257,6 +257,9 @@ module ProjectsHelper ...@@ -257,6 +257,9 @@ module ProjectsHelper
if project.builds_enabled? && can?(current_user, :read_pipeline, project) if project.builds_enabled? && can?(current_user, :read_pipeline, project)
nav_tabs << :pipelines nav_tabs << :pipelines
end
if can?(current_user, :read_environment, project) || can?(current_user, :read_cluster, project)
nav_tabs << :operations nav_tabs << :operations
end end
......
...@@ -44,6 +44,18 @@ describe 'Projects > User sees sidebar' do ...@@ -44,6 +44,18 @@ describe 'Projects > User sees sidebar' do
expect(page).not_to have_content 'Repository' expect(page).not_to have_content 'Repository'
expect(page).not_to have_content 'CI / CD' expect(page).not_to have_content 'CI / CD'
expect(page).not_to have_content 'Merge Requests' expect(page).not_to have_content 'Merge Requests'
expect(page).not_to have_content 'Operations'
end
end
it 'shows build tab if builds are public' do
project.public_builds = true
project.save
visit project_path(project)
within('.nav-sidebar') do
expect(page).to have_content 'CI / CD'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment