Commit d20473c1 authored by Nick Thomas's avatar Nick Thomas

Merge branch '11703-epic-hierarchy-quick-actions' into 'master'

Restrict hierarchy related epic quick actions in mysql

Closes #11703

See merge request gitlab-org/gitlab-ee!13152
parents 54451c02 34caa5dd
---
title: Restrict child_epic and remove_child_epic quick actions when using mysql
merge_request: 13152
author:
type: fixed
...@@ -51,7 +51,7 @@ module EE ...@@ -51,7 +51,7 @@ module EE
end end
def action_allowed? def action_allowed?
quick_action_target.group&.feature_available?(:epics) && ::Epic.supports_nested_objects? && quick_action_target.group&.feature_available?(:epics) &&
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
end end
......
...@@ -101,10 +101,10 @@ describe Groups::AutocompleteService do ...@@ -101,10 +101,10 @@ describe Groups::AutocompleteService do
end end
it 'returns available commands' do it 'returns available commands' do
expect(subject.commands(epic).map { |c| c[:name] }) available_commands = [:todo, :unsubscribe, :award, :shrug, :tableflip, :cc, :title, :close]
.to match_array( available_commands += [:child_epic, :remove_child_epic] if ::Epic.supports_nested_objects?
[:todo, :unsubscribe, :award, :shrug, :tableflip, :cc, :title, :close, :child_epic, :remove_child_epic]
) expect(subject.commands(epic).map { |c| c[:name] }).to match_array(available_commands)
end end
end end
end end
......
...@@ -807,7 +807,7 @@ describe QuickActions::InterpretService do ...@@ -807,7 +807,7 @@ describe QuickActions::InterpretService do
group.add_developer(current_user) group.add_developer(current_user)
end end
context 'child_epic command' do context 'child_epic command', :nested_groups do
context 'when correct epic reference' do context 'when correct epic reference' do
let(:content) { "/child_epic #{child_epic&.to_reference(epic)}" } let(:content) { "/child_epic #{child_epic&.to_reference(epic)}" }
...@@ -827,7 +827,7 @@ describe QuickActions::InterpretService do ...@@ -827,7 +827,7 @@ describe QuickActions::InterpretService do
end end
end end
context 'remove_child_epic command' do context 'remove_child_epic command', :nested_groups do
context 'when correct epic reference' do context 'when correct epic reference' do
let(:content) { "/remove_child_epic #{child_epic&.to_reference(epic)}" } let(:content) { "/remove_child_epic #{child_epic&.to_reference(epic)}" }
......
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