Commit c8cab6cb authored by Axel García's avatar Axel García

Add "New epic" item to "New (+)" dropdown

This item is only enabled if the current user can create epics and it's
under the create_epic_form flag
parent a8b86015
......@@ -15,6 +15,7 @@
%li= link_to _('New project'), new_project_path(namespace_id: @group.id)
- if create_group_subgroup
%li= link_to _('New subgroup'), new_group_path(parent_id: @group.id)
= render_if_exists 'layouts/header/create_epic_new_dropdown_item'
%li.divider
%li.dropdown-bold-header GitLab
......
......@@ -9,6 +9,10 @@ module EE
alias_method :ee_authorize_admin_group!, :authorize_admin_group!
before_action :ee_authorize_admin_group!, only: [:restore]
before_action do
push_frontend_feature_flag(:create_epic_form, @group)
end
end
override :render_show_html
......
- create_group_epic = can?(current_user, :create_epic, @group)
- return unless create_group_epic && Feature.enabled?(:create_epic_form)
%li= link_to _('New epic'), new_group_epic_path(@group)
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/header/_new_dropdown' do
let(:user) { create(:user) }
context 'group-specific links' do
let(:group) { create(:group) }
before do
allow(view).to receive(:current_user).and_return(user)
assign(:group, group)
end
context 'as a Group owner' do
before do
group.add_owner(user)
end
it 'does not have "New epic" link' do
render
expect(rendered).not_to have_link(
'New epic',
href: new_group_epic_path(group)
)
end
context 'when epics are enabled' do
before do
stub_licensed_features(epics: true)
stub_feature_flags(create_epic_form: true)
end
it 'has a "New epic" link' do
render
expect(rendered).to have_link(
'New epic',
href: new_group_epic_path(group)
)
end
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