Commit 856c22eb authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'master' into 'master'

Changed confidential quick action to only be available on non confidential issues

See merge request gitlab-org/gitlab!16902
parents 643d4fad 0147efae
---
title: Changed confidential quick action to only be available on non confidential issues
merge_request: 16902
author: Marc Schwede
type: fixed
...@@ -135,7 +135,8 @@ module Gitlab ...@@ -135,7 +135,8 @@ module Gitlab
end end
types Issue types Issue
condition do condition do
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target) !quick_action_target.confidential? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", quick_action_target)
end end
command :confidential do command :confidential do
@updates[:confidential] = true @updates[:confidential] = true
......
...@@ -586,6 +586,22 @@ describe QuickActions::InterpretService do ...@@ -586,6 +586,22 @@ describe QuickActions::InterpretService do
expect(message).to eq('Made this issue confidential.') expect(message).to eq('Made this issue confidential.')
end end
context 'when issuable is already confidential' do
before do
issuable.update(confidential: true)
end
it 'does not return the success message' do
_, _, message = service.execute(content, issuable)
expect(message).to be_empty
end
it 'is not part of the available commands' do
expect(service.available_commands(issuable)).not_to include(a_hash_including(name: :confidential))
end
end
end end
shared_examples 'shrug command' do shared_examples 'shrug command' do
......
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