Commit 3cff6cb3 authored by Alexandru Croitor's avatar Alexandru Croitor

Do not try to copy weight events when promoting an issue

When promoting an issue to an epic we copy over as much
information as possible, but we need to skip weight events as
epics do not support weights.
parent 42a77036
......@@ -56,7 +56,7 @@ module Issuable
end
def copy_resource_weight_events
return unless original_entity.respond_to?(:resource_weight_events)
return unless both_respond_to?(:resource_weight_events)
copy_events(ResourceWeightEvent.table_name, original_entity.resource_weight_events) do |event|
event.attributes
......
---
title: Do not try to copy issue weight events when promoting an issue to epic
merge_request: 43891
author:
type: fixed
......@@ -39,6 +39,16 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
subject.execute
end
end
context 'when issue has weight events' do
it 'ignores copying weight events' do
create_list(:resource_weight_event, 2, issue: original_issue)
expect(subject).not_to receive(:copy_events).with(ResourceWeightEvent.table_name, any_args)
expect { subject.execute }.not_to change { ResourceWeightEvent.count }
end
end
end
end
end
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