Commit 4a557819 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'remove_milestone_id_from_epics' into 'master'

Ignore milestone_id from epics table 1/3

See merge request gitlab-org/gitlab!20187
parents 5b30e143 892c6461
...@@ -173,7 +173,7 @@ module Issuable ...@@ -173,7 +173,7 @@ module Issuable
private private
def milestone_is_valid 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 end
def description_max_length_for_new_records_is_valid def description_max_length_for_new_records_is_valid
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Placeholder class for model that is implemented in EE # Placeholder class for model that is implemented in EE
# It reserves '&' as a reference prefix, but the table does not exists in CE # It reserves '&' as a reference prefix, but the table does not exists in CE
class Epic < ApplicationRecord class Epic < ApplicationRecord
self.ignored_columns += %i[milestone_id]
def self.link_reference_pattern def self.link_reference_pattern
nil nil
end end
......
...@@ -10,7 +10,13 @@ module Issuable ...@@ -10,7 +10,13 @@ module Issuable
end end
def execute 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 copy_resource_label_events
end end
......
---
title: Remove milestone_id from epics
merge_request: 20187
author: Lee Tickett
type: other
...@@ -47,7 +47,6 @@ tables: ...@@ -47,7 +47,6 @@ tables:
epics: epics:
whitelist: whitelist:
- id - id
- milestone_id
- group_id - group_id
- author_id - author_id
- assignee_id - assignee_id
......
...@@ -30,11 +30,11 @@ describe Issuable::Clone::AttributesRewriter do ...@@ -30,11 +30,11 @@ describe Issuable::Clone::AttributesRewriter do
end end
context 'setting milestones' do context 'setting milestones' do
it 'sets milestone attribute as nil' do it 'ignores milestone attribute' do
milestone = create(:milestone, title: 'milestone', group: group) milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone) 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 subject.execute
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