Commit 7599d8c1 authored by Felipe Artur's avatar Felipe Artur

Block confidential quick action for test cases

Hide /confidential quick action
for issues with test case type
parent 45be2c38
......@@ -10,7 +10,8 @@ module IssueAvailableFeatures
# EE only features are listed on EE::IssueAvailableFeatures
def available_features_for_issue_types
{
assignee: %w(issue incident)
assignee: %w(issue incident),
confidentiality: %(issue incident)
}.with_indifferent_access
end
end
......
---
title: Block confidential quick action for test cases
merge_request: 50460
author:
type: other
......@@ -989,6 +989,18 @@ RSpec.describe QuickActions::InterpretService do
let(:issuable) { build(:merge_request, source_project: project) }
end
end
context 'confidential command' do
context 'for test cases' do
it 'does not mark to update confidential attribute' do
issuable = create(:quality_test_case, project: project)
_, updates, _ = service.execute('/confidential', issuable)
expect(updates[:confidential]).to eq(nil)
end
end
end
end
describe '#explain' do
......
......@@ -170,7 +170,8 @@ module Gitlab
end
types Issue
condition do
!quick_action_target.confidential? &&
quick_action_target.issue_type_supports?(:confidentiality) &&
!quick_action_target.confidential? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target)
end
command :confidential do
......
......@@ -1142,6 +1142,11 @@ RSpec.describe QuickActions::InterpretService do
let(:issuable) { issue }
end
it_behaves_like 'confidential command' do
let(:content) { '/confidential' }
let(:issuable) { create(:incident, project: project) }
end
it_behaves_like 'lock command' do
let(:content) { '/lock' }
let(:issuable) { issue }
......
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