Commit a2b60099 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'fix-missing-emoji-import' into 'master'

Add support to import award emojis for missing entities

See merge request gitlab-org/gitlab!22493
parents 30160961 7237bfa2
---
title: Add support to export and import award emojis for issues, issue notes, MR, MR notes and snippet notes
merge_request: 22493
author:
type: fixed
......@@ -16,6 +16,7 @@ tree:
- :timelogs
- notes:
- :author
- :award_emoji
- events:
- :push_event_payload
- label_links:
......@@ -32,18 +33,22 @@ tree:
- :issue_assignees
- :zoom_meetings
- :sentry_issue
- :award_emoji
- snippets:
- :award_emoji
- notes:
- :author
- :award_emoji
- releases:
- :links
- project_members:
- :user
- merge_requests:
- :metrics
- :award_emoji
- notes:
- :author
- :award_emoji
- events:
- :push_event_payload
- :suggestions
......
......@@ -80,6 +80,17 @@
"issue_id": 40
}
],
"award_emoji": [
{
"id": 1,
"name": "musical_keyboard",
"user_id": 1,
"awardable_type": "Issue",
"awardable_id": 40,
"created_at": "2020-01-07T11:55:22.234Z",
"updated_at": "2020-01-07T11:55:22.234Z"
}
],
"zoom_meetings": [
{
"id": 1,
......@@ -188,7 +199,18 @@
"author": {
"name": "User 4"
},
"events": []
"events": [],
"award_emoji": [
{
"id": 1,
"name": "clapper",
"user_id": 1,
"awardable_type": "Note",
"awardable_id": 351,
"created_at": "2020-01-07T11:55:22.234Z",
"updated_at": "2020-01-07T11:55:22.234Z"
}
]
},
{
"id": 352,
......@@ -2297,7 +2319,32 @@
"updated_at": "2019-11-05T15:37:24.645Z"
}
],
"notes": []
"notes": [
{
"id": 872,
"note": "This is a test note",
"noteable_type": "Snippet",
"author_id": 1,
"created_at": "2019-11-05T15:37:24.645Z",
"updated_at": "2019-11-05T15:37:24.645Z",
"noteable_id": 1,
"author": {
"name": "Random name"
},
"events": [],
"award_emoji": [
{
"id": 12,
"name": "thumbsup",
"user_id": 1,
"awardable_type": "Note",
"awardable_id": 872,
"created_at": "2019-11-05T15:37:21.287Z",
"updated_at": "2019-11-05T15:37:21.287Z"
}
]
}
]
}
],
"releases": [],
......@@ -2434,7 +2481,18 @@
"author": {
"name": "User 4"
},
"events": []
"events": [],
"award_emoji": [
{
"id": 1,
"name": "tada",
"user_id": 1,
"awardable_type": "Note",
"awardable_id": 1,
"created_at": "2019-11-05T15:37:21.287Z",
"updated_at": "2019-11-05T15:37:21.287Z"
}
]
},
{
"id": 672,
......@@ -2840,7 +2898,27 @@
"author_id": 1
}
],
"approvals_before_merge": 1
"approvals_before_merge": 1,
"award_emoji": [
{
"id": 1,
"name": "thumbsup",
"user_id": 1,
"awardable_type": "MergeRequest",
"awardable_id": 27,
"created_at": "2020-01-07T11:21:21.235Z",
"updated_at": "2020-01-07T11:21:21.235Z"
},
{
"id": 2,
"name": "drum",
"user_id": 1,
"awardable_type": "MergeRequest",
"awardable_id": 27,
"created_at": "2020-01-07T11:21:21.235Z",
"updated_at": "2020-01-07T11:21:21.235Z"
}
]
},
{
"id": 26,
......
......@@ -219,6 +219,16 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'coffee')
end
it 'snippet has notes' do
expect(@project.snippets.first.notes.count).to eq(1)
end
it 'snippet has award emojis on notes' do
award_emoji = @project.snippets.first.notes.first.award_emoji.first
expect(award_emoji.name).to eq('thumbsup')
end
it 'restores `ci_cd_settings` : `group_runners_enabled` setting' do
expect(@project.ci_cd_settings.group_runners_enabled?).to eq(false)
end
......@@ -240,6 +250,18 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(sentry_issue.sentry_issue_identifier).to eq(1234567891)
end
it 'has award emoji for an issue' do
award_emoji = @project.issues.first.award_emoji.first
expect(award_emoji.name).to eq('musical_keyboard')
end
it 'has award emoji for a note in an issue' do
award_emoji = @project.issues.first.notes.first.award_emoji.first
expect(award_emoji.name).to eq('clapper')
end
it 'restores container_expiration_policy' do
policy = Project.find_by_path('project').container_expiration_policy
......@@ -266,6 +288,20 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
it 'has no source if source/target differ' do
expect(MergeRequest.find_by_title('MR2').source_project_id).to be_nil
end
it 'has award emoji' do
award_emoji = MergeRequest.find_by_title('MR1').award_emoji
expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'drum')
end
context 'notes' do
it 'has award emoji' do
award_emoji = MergeRequest.find_by_title('MR1').notes.first.award_emoji.first
expect(award_emoji.name).to eq('tada')
end
end
end
context 'tokens are regenerated' do
......
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