Commit 121d10cb authored by David O'Regan's avatar David O'Regan Committed by Heinrich Lee Yu

Remove iteration quick actions

parent f174031b
......@@ -137,6 +137,10 @@ module EE
!incident?
end
def supports_iterations?
!incident?
end
def can_assign_epic?(user)
user&.can?(:admin_epic, project.group)
end
......
......@@ -96,7 +96,8 @@ module EE
params '*iteration:"iteration name"'
types Issue
condition do
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project) &&
quick_action_target.supports_iterations? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project) &&
quick_action_target.project.group&.feature_available?(:iterations) &&
find_iterations(project, state: 'active').any?
end
......@@ -117,7 +118,8 @@ module EE
end
types Issue
condition do
quick_action_target.persisted? &&
quick_action_target.supports_iterations? &&
quick_action_target.persisted? &&
quick_action_target.sprint_id? &&
quick_action_target.project.group&.feature_available?(:iterations) &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project)
......
......@@ -739,4 +739,24 @@ RSpec.describe Issue do
end
end
end
describe '#supports_iterations?' do
let(:group) { build_stubbed(:group) }
let(:project_with_group) { build_stubbed(:project, group: group) }
where(:issuable_type, :project, :supports_iterations) do
[
[:issue, :project_with_group, true],
[:incident, :project_with_group, false]
]
end
with_them do
let(:issue) { build_stubbed(issuable_type, project: send(project)) }
subject { issue.supports_iterations? }
it { is_expected.to eq(supports_iterations) }
end
end
end
......@@ -272,6 +272,16 @@ RSpec.describe QuickActions::InterpretService do
expect(updates).to be_empty
end
end
context 'when issuable does not support iterations' do
it 'does not assign an iteration to an incident' do
incident = create(:incident, project: project)
_, updates = service.execute(content, incident)
expect(updates).to be_empty
end
end
end
context 'remove_iteration command' do
......@@ -318,6 +328,16 @@ RSpec.describe QuickActions::InterpretService do
expect(updates).to be_empty
end
end
context 'when issuable does not support iterations' do
it 'does not assign an iteration to an incident' do
incident = create(:incident, project: project)
_, updates = service.execute(content, incident)
expect(updates).to be_empty
end
end
end
context 'epic 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