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

Merge branch '241406-remove-iteration-quick-actions' into 'master'

Remove iteration quick actions

See merge request gitlab-org/gitlab!41991
parents 06329a09 121d10cb
......@@ -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,6 +96,7 @@ module EE
params '*iteration:"iteration name"'
types Issue
condition do
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?
......@@ -117,6 +118,7 @@ module EE
end
types Issue
condition do
quick_action_target.supports_iterations? &&
quick_action_target.persisted? &&
quick_action_target.sprint_id? &&
quick_action_target.project.group&.feature_available?(:iterations) &&
......
......@@ -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