Commit 892c6461 authored by Lee Tickett's avatar Lee Tickett Committed by Jan Provaznik

Ignore milestone_id from epics table 1/3

parent 5b30e143
......@@ -173,7 +173,7 @@ module Issuable
private
def milestone_is_valid
errors.add(:milestone_id, message: "is invalid") if milestone_id.present? && !milestone_available?
errors.add(:milestone_id, message: "is invalid") if respond_to?(:milestone_id) && milestone_id.present? && !milestone_available?
end
def description_max_length_for_new_records_is_valid
......
......@@ -3,6 +3,8 @@
# Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE
class Epic < ApplicationRecord
self.ignored_columns += %i[milestone_id]
def self.link_reference_pattern
nil
end
......
......@@ -10,7 +10,13 @@ module Issuable
end
def execute
new_entity.update(milestone: cloneable_milestone, labels: cloneable_labels)
update_attributes = { labels: cloneable_labels }
milestone = cloneable_milestone
update_attributes[:milestone] = milestone if milestone.present?
new_entity.update(update_attributes)
copy_resource_label_events
end
......
---
title: Remove milestone_id from epics
merge_request: 20187
author: Lee Tickett
type: other
......@@ -47,7 +47,6 @@ tables:
epics:
whitelist:
- id
- milestone_id
- group_id
- author_id
- assignee_id
......
......@@ -30,11 +30,11 @@ describe Issuable::Clone::AttributesRewriter do
end
context 'setting milestones' do
it 'sets milestone attribute as nil' do
it 'ignores milestone attribute' do
milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone)
expect(new_epic).to receive(:update).with(labels: [], milestone: nil)
expect(new_epic).to receive(:update).with(labels: [])
subject.execute
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