Commit cddd1f43 authored by Max Woolf's avatar Max Woolf

Merge branch...

Merge branch '349920-jira-integration-menu-item-should-be-visible-when-gitlab-issues-are-disabled' into 'master'

Show "Issues" menu when Jira issues is enabled

See merge request gitlab-org/gitlab!78467
parents 9a6ef53c 09d3fa8d
......@@ -9,7 +9,7 @@ module EE
override :configure_menu_items
def configure_menu_items
return false unless super
return false unless super || show_jira_menu_items?
add_item(iterations_menu_item)
add_item(requirements_menu_item)
......@@ -26,7 +26,8 @@ module EE
private
def iterations_menu_item
if !context.project.licensed_feature_available?(:iterations) ||
if !show_issues_menu_items? ||
!context.project.licensed_feature_available?(:iterations) ||
!can?(context.current_user, :read_iteration, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :iterations)
end
......@@ -43,7 +44,8 @@ module EE
end
def requirements_menu_item
if !context.project.licensed_feature_available?(:requirements) ||
if !show_issues_menu_items? ||
!context.project.licensed_feature_available?(:requirements) ||
!can?(context.current_user, :read_requirement, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :requirements)
end
......
......@@ -7,6 +7,35 @@ RSpec.describe Sidebars::Projects::Menus::IssuesMenu do
let(:user) { project.owner }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project) }
describe '#render?' do
let_it_be_with_refind(:project) { create(:project, has_external_issue_tracker: true) }
let_it_be(:jira) { create(:jira_integration, project: project, project_key: 'GL') }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project, jira_issues_integration: jira_issues_integration) }
let(:jira_issues_integration) { true }
subject { described_class.new(context).render? }
context 'when user cannot read issues and Jira is not enabled' do
let(:user) { nil }
let(:jira_issues_integration) { false }
it { is_expected.to eq(false) }
end
context 'when user cannot read issues but Jira is enabled' do
let(:user) { nil }
it { is_expected.to eq(true) }
end
context 'when Jira is not enabled but user can read issues' do
let(:jira_issues_integration) { false }
it { is_expected.to eq(true) }
end
end
describe 'Iterations' do
subject { described_class.new(context).renderable_items.index { |e| e.item_id == :iterations} }
......
......@@ -8,7 +8,7 @@ module Sidebars
override :configure_menu_items
def configure_menu_items
return unless can?(context.current_user, :read_issue, context.project)
return false unless show_issues_menu_items?
add_item(list_menu_item)
add_item(boards_menu_item)
......@@ -70,6 +70,10 @@ module Sidebars
private
def show_issues_menu_items?
can?(context.current_user, :read_issue, context.project)
end
def list_menu_item
::Sidebars::MenuItem.new(
title: _('List'),
......
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