diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-20 17:05:21 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-03-20 17:05:21 +0100 |
commit | d6474f22d263e5c04318c64979dfec3f7f45b7bc (patch) | |
tree | bc3cc689c9d05a7d4e025f81c74b25839011f68a | |
parent | 797af06491b8e9bbc7eb75466b0cf3fabd0f14d8 (diff) | |
download | gitlab-ce-d6474f22d263e5c04318c64979dfec3f7f45b7bc.tar.gz |
Preserve created at time of notes when moving issue
-rw-r--r-- | app/services/issues/move_service.rb | 3 | ||||
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/services/issues/move_service.rb b/app/services/issues/move_service.rb index c5b2bf80e0b..3cfbafe1576 100644 --- a/app/services/issues/move_service.rb +++ b/app/services/issues/move_service.rb @@ -53,7 +53,8 @@ module Issues @old_issue.notes.find_each do |note| new_note = note.dup new_params = { project: @new_project, noteable: @new_issue, - note: unfold_references(new_note.note) } + note: unfold_references(new_note.note), + created_at: note.created_at } new_note.update(new_params) end diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index cd24af88d5f..14cc20e529a 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -121,6 +121,11 @@ describe Issues::MoveService, services: true do it 'preserves orignal author of comment' do expect(user_notes.pluck(:author_id)).to all(eq(author.id)) end + + it 'preserves time when note has been created at' do + expect(old_issue.notes.first.created_at) + .to eq new_issue.notes.first.created_at + end end context 'notes with references' do |