Commit f8fd6d01 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'issue_270585-block_confidential_quick_action' into 'master'

Block confidential quick action for test cases

See merge request gitlab-org/gitlab!50460
parents 194ed506 7599d8c1
...@@ -10,7 +10,8 @@ module IssueAvailableFeatures ...@@ -10,7 +10,8 @@ module IssueAvailableFeatures
# EE only features are listed on EE::IssueAvailableFeatures # EE only features are listed on EE::IssueAvailableFeatures
def available_features_for_issue_types def available_features_for_issue_types
{ {
assignee: %w(issue incident) assignee: %w(issue incident),
confidentiality: %(issue incident)
}.with_indifferent_access }.with_indifferent_access
end end
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 ...@@ -989,6 +989,18 @@ RSpec.describe QuickActions::InterpretService do
let(:issuable) { build(:merge_request, source_project: project) } let(:issuable) { build(:merge_request, source_project: project) }
end end
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 end
describe '#explain' do describe '#explain' do
......
...@@ -170,6 +170,7 @@ module Gitlab ...@@ -170,6 +170,7 @@ module Gitlab
end end
types Issue types Issue
condition do condition do
quick_action_target.issue_type_supports?(:confidentiality) &&
!quick_action_target.confidential? && !quick_action_target.confidential? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target) current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target)
end end
......
...@@ -1142,6 +1142,11 @@ RSpec.describe QuickActions::InterpretService do ...@@ -1142,6 +1142,11 @@ RSpec.describe QuickActions::InterpretService do
let(:issuable) { issue } let(:issuable) { issue }
end end
it_behaves_like 'confidential command' do
let(:content) { '/confidential' }
let(:issuable) { create(:incident, project: project) }
end
it_behaves_like 'lock command' do it_behaves_like 'lock command' do
let(:content) { '/lock' } let(:content) { '/lock' }
let(:issuable) { issue } 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