Commit 4ce6d2b9 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'sh-fix-import-export-suggestions' into 'master'

Properly save suggestions in project exports

Closes #65880

See merge request gitlab-org/gitlab-ce!31690
parents 97576360 26107e93
---
title: Properly save suggestions in project exports
merge_request: 31690
author:
type: fixed
...@@ -37,11 +37,11 @@ project_tree: ...@@ -37,11 +37,11 @@ project_tree:
- :user - :user
- merge_requests: - merge_requests:
- :metrics - :metrics
- :suggestions
- notes: - notes:
- :author - :author
- events: - events:
- :push_event_payload - :push_event_payload
- :suggestions
- merge_request_diff: - merge_request_diff:
- :merge_request_diff_commits - :merge_request_diff_commits
- :merge_request_diff_files - :merge_request_diff_files
......
...@@ -2450,7 +2450,21 @@ ...@@ -2450,7 +2450,21 @@
"author": { "author": {
"name": "Ottis Schuster II" "name": "Ottis Schuster II"
}, },
"events": [] "events": [],
"suggestions": [
{
"id": 1,
"note_id": 674,
"relative_order": 0,
"applied": false,
"commit_id": null,
"from_content": "Original line\n",
"to_content": "New line\n",
"lines_above": 0,
"lines_below": 0,
"outdated": false
}
]
}, },
{ {
"id": 675, "id": 675,
......
...@@ -125,6 +125,13 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -125,6 +125,13 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(MergeRequest.find_by(title: 'MR1').resource_label_events).not_to be_empty expect(MergeRequest.find_by(title: 'MR1').resource_label_events).not_to be_empty
end end
it 'restores suggestion' do
note = Note.find_by("note LIKE 'Saepe asperiores exercitationem non dignissimos laborum reiciendis et ipsum%'")
expect(note.suggestions.count).to eq(1)
expect(note.suggestions.first.from_content).to eq("Original line\n")
end
context 'event at forth level of the tree' do context 'event at forth level of the tree' do
let(:event) { Event.where(action: 6).first } let(:event) { Event.where(action: 6).first }
......
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