Commit 807e746a authored by Justin Ho's avatar Justin Ho

Show "Issues" menu when Jira issues is enabled

When GitLab issues is disabled but Jira issues enabled,
we still want to show the "Issues" menu to allow users
to access Jira issues.

This was a regression since in a previous MR, we moved
the Jira menu items from their own menu to the shared
"Issues" menu.

Changelog: fixed
EE: true
parent 798aa0e7
......@@ -9,7 +9,7 @@ module EE
override :configure_menu_items
def configure_menu_items
return false unless super
return false if !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