Commit 1f1e125f authored by Stan Hu's avatar Stan Hu

Merge branch '327727-fix-epics-bulk-update' into 'master'

Fix Epic bulk updates leaking to other epics

See merge request gitlab-org/gitlab!68730
parents a91e5348 dc53ff7b
......@@ -57,7 +57,11 @@ module Issuable
items.each do |issuable|
next unless can?(current_user, :"update_#{type}", issuable)
update_class.new(**update_class.constructor_container_arg(issuable.issuing_parent), current_user: current_user, params: params).execute(issuable)
update_class.new(
**update_class.constructor_container_arg(issuable.issuing_parent),
current_user: current_user,
params: params.dup
).execute(issuable)
end
items
......
......@@ -203,6 +203,19 @@ RSpec.describe Issuable::BulkUpdateService do
let(:new_value) { [label2, label3] }
it_behaves_like 'updates issuables attribute', :labels
context 'when epics have different labels' do
let(:label4) { create(:group_label, group: group, title: 'feature') }
let(:epic1) { create(:epic, group: group, labels: [label1, label4]) }
it 'keeps existing labels' do
expect(subject.success?).to be_truthy
expect(subject.payload[:count]).to eq(issuables.count)
expect(epic1.reload.labels).to contain_exactly(label4, label2, label3)
expect(epic2.reload.labels).to contain_exactly(label2, label3)
end
end
end
context 'when epics are disabled' 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