Commit 165d799f authored by Sean McGivern's avatar Sean McGivern Committed by Alfredo Sumaran

Allow bulk-updating to remove all labels

Instead of passing `remove_label_ids`, just pass an empty array for
`label_ids` (and don't pass `add_label_ids` or `remove_label_ids`).
parent d78fd6df
...@@ -4,7 +4,7 @@ module Issues ...@@ -4,7 +4,7 @@ module Issues
issues_ids = params.delete(:issues_ids).split(",") issues_ids = params.delete(:issues_ids).split(",")
issue_params = params issue_params = params
[:state_event, :milestone_id, :assignee_id, :label_ids, :add_label_ids, :remove_label_ids].each do |key| %i(state_event milestone_id assignee_id add_label_ids remove_label_ids).each do |key|
issue_params.delete(key) unless issue_params[key].present? issue_params.delete(key) unless issue_params[key].present?
end end
......
...@@ -148,6 +148,14 @@ describe Issues::BulkUpdateService, services: true do ...@@ -148,6 +148,14 @@ describe Issues::BulkUpdateService, services: true do
it 'does not update issues not passed in' do it 'does not update issues not passed in' do
expect(issue_bug_and_regression.label_ids).to contain_exactly(bug.id, regression.id) expect(issue_bug_and_regression.label_ids).to contain_exactly(bug.id, regression.id)
end end
context 'when those label IDs are empty' do
let(:labels) { [] }
it 'updates the issues passed to have no labels' do
expect(issues.map(&:reload).map(&:label_ids)).to all(be_empty)
end
end
end end
context 'when add_label_ids are passed' do context 'when add_label_ids are passed' 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