diff options
3 files changed, 59 insertions, 2 deletions
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 6b33189d1cf..3a0c2b9c284 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -357,12 +357,12 @@ = link_to project_settings_repository_path(@project), title: _('Repository') do %span = _('Repository') - - if @project.feature_available?(:builds, current_user) + - if !@project.archived? && @project.feature_available?(:builds, current_user) = nav_link(controller: :ci_cd) do = link_to project_settings_ci_cd_path(@project), title: _('CI / CD') do %span = _('CI / CD') - - if settings_operations_available? + - if !@project.archived? && settings_operations_available? = nav_link(controller: [:operations]) do = link_to project_settings_operations_path(@project), title: _('Operations') do = _('Operations') diff --git a/changelogs/unreleased/58793-fix-nav-links-archived-project.yml b/changelogs/unreleased/58793-fix-nav-links-archived-project.yml new file mode 100644 index 00000000000..a8250804c34 --- /dev/null +++ b/changelogs/unreleased/58793-fix-nav-links-archived-project.yml @@ -0,0 +1,5 @@ +--- +title: "Disable inaccessible navigation links upon archiving a project" +merge_request: 26020 +author: Elias Werberich +type: fixed diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 2c60ccfb754..c6c10001bc5 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -113,4 +113,56 @@ describe 'layouts/nav/sidebar/_project' do end end end + + describe 'ci/cd settings tab' do + before do + project.update!(archived: project_archived) + end + + context 'when project is archived' do + let(:project_archived) { true } + + it 'does not show the ci/cd settings tab' do + render + + expect(rendered).not_to have_link('CI / CD', href: project_settings_ci_cd_path(project)) + end + end + + context 'when project is active' do + let(:project_archived) { false } + + it 'shows the ci/cd settings tab' do + render + + expect(rendered).to have_link('CI / CD', href: project_settings_ci_cd_path(project)) + end + end + end + + describe 'operations settings tab' do + before do + project.update!(archived: project_archived) + end + + context 'when project is archived' do + let(:project_archived) { true } + + it 'does not show the operations settings tab' do + render + + expect(rendered).not_to have_link('Operations', href: project_settings_operations_path(project)) + end + end + + context 'when project is active' do + let(:project_archived) { false } + + it 'shows the operations settings tab' do + render + + expect(rendered).to have_link('Operations', href: project_settings_operations_path(project)) + end + end + end end |