Commit cf21460b authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '196806-bulk-edit-iteratiions_allow-removing' into 'master'

Allow removing iterations in Issues::Updateservice

See merge request gitlab-org/gitlab!51179
parents 62795e9a ae4968d0
......@@ -74,6 +74,18 @@ module EE
def epic_param_present?
params.key?(:epic) || params.key?(:epic_id)
end
def filter_iteration
return unless params[:sprint_id]
return params[:sprint_id] = '' if params[:sprint_id] == IssuableFinder::Params::NONE
groups = project.group&.self_and_ancestors&.select(:id)
iteration =
::Iteration.for_projects_and_groups([project.id], groups).find_by_id(params[:sprint_id])
params[:sprint_id] = '' unless iteration
end
end
end
end
......@@ -8,7 +8,10 @@ module EE
override :filter_params
def filter_params(issue)
params.delete(:sprint_id) unless can_admin_issuable?(issue)
handle_epic(issue)
filter_iteration
super
end
......
......@@ -62,6 +62,22 @@ RSpec.describe Issues::UpdateService do
end
end
context 'setting to IssuableFinder::Params::NONE' do
it 'calls NotificationService#removed_iteration_issue' do
expect_next_instance_of(NotificationService::Async) do |ns|
expect(ns).to receive(:removed_iteration_issue)
end
update_issue(sprint_id: IssuableFinder::Params::NONE)
end
it 'removes the iteration properly' do
update_issue(sprint_id: IssuableFinder::Params::NONE)
expect(issue.reload.iteration).to be_nil
end
end
context 'setting to another iteration' do
it 'calls NotificationService#changed_iteration_issue' do
expect_next_instance_of(NotificationService::Async) do |ns|
......
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