Commit b9820177 authored by Alexandru Croitor's avatar Alexandru Croitor

Move ResourceWeightevent model to EE

Issue weights is an EES feature, so the related ResourceWeightevent
model should be placed in EE
parent 9cd8f37f
......@@ -18,7 +18,6 @@ module Issuable
new_entity.update(update_attributes)
copy_resource_label_events
copy_resource_weight_events
copy_resource_milestone_events
copy_resource_state_events
end
......@@ -55,16 +54,6 @@ module Issuable
end
end
def copy_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
.except('id', 'reference', 'reference_html')
.merge('issue_id' => new_entity.id)
end
end
def copy_resource_milestone_events
return unless milestone_events_supported?
......@@ -128,3 +117,5 @@ module Issuable
end
end
end
Issuable::Clone::AttributesRewriter.prepend_if_ee('EE::Issuable::Clone::AttributesRewriter')
# frozen_string_literal: true
module EE
module Issuable
module Clone
module AttributesRewriter
extend ::Gitlab::Utils::Override
override :execute
def execute
super
copy_resource_weight_events
end
private
def copy_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.except('id').merge('issue_id' => new_entity.id)
end
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