Commit b696e7d3 authored by Scott Stern's avatar Scott Stern Committed by Heinrich Lee Yu

Change route for iterations at the group level in right sidebar

parent f67f17a8
......@@ -143,8 +143,12 @@ module EE
links << :productivity_analytics
end
if ::Feature.enabled?(:group_iterations, @group, default_enabled: true) && @group.licensed_feature_available?(:iterations) && can?(current_user, :read_iteration, @group)
links << :iterations
if ::Feature.enabled?(:group_iterations, @group, default_enabled: true) && @group.licensed_feature_available?(:iterations)
if ::Feature.enabled?(:iteration_cadences, @group, default_enabled: :yaml) && can?(current_user, :read_iteration_cadence, @group)
links << :iteration_cadences
elsif can?(current_user, :read_iteration, @group)
links << :iterations
end
end
if ::Feature.enabled?(:group_ci_cd_analytics_page, @group, default_enabled: true) && @group.licensed_feature_available?(:group_ci_cd_analytics) && can?(current_user, :view_group_ci_cd_analytics, @group)
......
......@@ -32,7 +32,13 @@ module EE
end
def iterations_sub_menu_controllers
['iterations#index', 'iterations#show']
paths = ['iterations#index', 'iterations#show']
if ::Feature.enabled?(:iteration_cadences, @group, default_enabled: :yaml)
paths << 'iteration_cadences#index'
end
paths
end
end
end
- if group_sidebar_link?(:iterations)
- if group_sidebar_link?(:iteration_cadences) || group_sidebar_link?(:iterations)
- iterations_path = Feature.enabled?(:iteration_cadences, @group, default_enabled: :yaml) ? group_iteration_cadences_path(@group) : group_iterations_path(@group)
= nav_link(path: iterations_sub_menu_controllers) do
= link_to group_iterations_path(@group), data: { qa_selector: 'group_iterations_link' } do
= link_to iterations_path, data: { qa_selector: 'group_iterations_link' } do
%span
= _('Iterations')
......@@ -102,6 +102,27 @@ RSpec.describe GroupsHelper do
expect(helper.group_sidebar_links).not_to include(:group_ci_cd_analytics)
end
end
context 'when iterations is available' do
before do
stub_licensed_features(iterations: true)
stub_feature_flags(iteration_cadences: false)
end
it 'shows iterations link' do
expect(helper.group_sidebar_links).to include(:iterations)
end
context 'when iteration_cadences is available' do
before do
stub_feature_flags(iteration_cadences: true)
end
it 'shows iterations link' do
expect(helper.group_sidebar_links).to include(:iteration_cadences)
end
end
end
end
describe '#render_setting_to_allow_project_access_token_creation?' do
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe NavHelper do
describe '#iterations_sub_menu_controllers' do
context 'when :iteration_cadences is turned on' do
it 'includes iteration_cadences#index path in the list' do
expect(helper.iterations_sub_menu_controllers).to include('iteration_cadences#index')
end
end
context 'when :iteration_cadences is NOT turned on' do
before do
stub_feature_flags(iteration_cadences: false)
end
it 'includes iteration_cadences#index path in the list' do
expect(helper.iterations_sub_menu_controllers).not_to include('iteration_cadences#index')
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