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`).
This commit is contained in:
parent
d78fd6df0c
commit
165d799fb3
2 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,7 @@ module Issues
|
|||
issues_ids = params.delete(:issues_ids).split(",")
|
||||
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?
|
||||
end
|
||||
|
||||
|
|
|
@ -148,6 +148,14 @@ describe Issues::BulkUpdateService, services: true do
|
|||
it 'does not update issues not passed in' do
|
||||
expect(issue_bug_and_regression.label_ids).to contain_exactly(bug.id, regression.id)
|
||||
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
|
||||
|
||||
context 'when add_label_ids are passed' do
|
||||
|
|
Loading…
Reference in a new issue