Commit f9ae8208 authored by George Koltsov's avatar George Koltsov

Preserve Epics state on Group Import

- This change fixes a bug with Group Import where
  imported epics always had state 'opened' regardless of
  original state due to state_id being filtered out on
  Import
- Added tests to check epic state. Closed state specifically
parent 5003b5eb
---
title: Fix epics not preserving their state on Group Import
merge_request: 28203
author:
type: fixed
......@@ -234,7 +234,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": [
......@@ -291,6 +291,38 @@
"updated_at": "2019-11-05T15:37:21.287Z"
}
]
},
{
"id": 13623,
"milestone_id": null,
"group_id": 4351,
"author_id": 1,
"assignee_id": null,
"iid": 1,
"updated_by_id": null,
"last_edited_by_id": null,
"lock_version": 0,
"start_date": null,
"end_date": null,
"last_edited_at": null,
"created_at": "2019-12-20T17:02:09.754Z",
"updated_at": "2019-12-20T18:38:40.054Z",
"title": "Provident neque consequatur numquam ad voluptatem magnam.",
"description": "Fugit nisi",
"start_date_sourcing_milestone_id": null,
"due_date_sourcing_milestone_id": null,
"start_date_fixed": null,
"due_date_fixed": null,
"start_date_is_fixed": null,
"due_date_is_fixed": null,
"closed_by_id": null,
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state": "closed",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
}
]
}
......@@ -21,12 +21,17 @@ describe Gitlab::ImportExport::Group::TreeRestorer do
describe 'restore group tree' do
context 'epics' do
it 'has group epics' do
expect(group.epics.count).to eq(1)
expect(group.epics.count).to eq(2)
end
it 'has award emoji' do
expect(group.epics.first.award_emoji.first.name).to eq('thumbsup')
end
it 'preserves epic state' do
expect(group.epics.first.state).to eq('opened')
expect(group.epics.last.state).to eq('closed')
end
end
context 'epic notes' do
......
......@@ -36,6 +36,8 @@ excluded_attributes:
- :runners_token_encrypted
- :saml_discovery_token
- :visibility_level
epics:
- :state_id
methods:
labels:
......@@ -50,6 +52,8 @@ methods:
- :action
lists:
- :list_type
epics:
- :state
preloads:
......
......@@ -1492,7 +1492,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
......@@ -1524,7 +1524,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "closed",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
......@@ -1556,7 +1556,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
......@@ -1588,7 +1588,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "closed",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
......@@ -1620,7 +1620,7 @@
"closed_at": null,
"parent_id": null,
"relative_position": null,
"state_id": "opened",
"state": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"notes": []
......
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