Commit b9b41ff5 authored by George Koltsov's avatar George Koltsov

Fix issues missing on epic's page after project import

- This MR fixes issues being missing on Epic page
  after project import. The issues were associated with an epic
  correctly, but were not shown on Epic page, because
  epic_issue relation had relative_position: nil.
- Now epic_issue is exported, that contains epic, which will
  preserve relative_position, which is required in order
  for the issue to be shown on Epic's page.
parent 6f4bb03a
---
title: Fix issues missing on epic's page after project import
merge_request: 26099
author:
type: fixed
......@@ -18,6 +18,7 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end
context 'with group' do
let(:issue) { project.issues.find_by_title('Issue with Epic') }
let!(:project) do
create(:project,
:builds_disabled,
......@@ -35,7 +36,8 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect { restored_project_json }.not_to change { Epic.count }
expect(project.group.epics.count).to eq(1)
expect(project.issues.find_by_title('Issue with Epic').epic).not_to be_nil
expect(issue.epic).to eq(epic)
expect(issue.epic_issue.relative_position).not_to be_nil
end
end
......@@ -45,7 +47,9 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect { restored_project_json }.to change { Epic.count }.from(0).to(1)
expect(project.group.epics.count).to eq(1)
expect(project.issues.find_by_title('Issue with Epic').epic).not_to be_nil
expect(issue.epic).not_to be_nil
expect(issue.epic_issue.relative_position).not_to be_nil
end
end
end
......
......@@ -60,12 +60,21 @@ describe Gitlab::ImportExport::Project::TreeSaver do
end
context 'epics' do
it 'has issue epic' do
expect(saved_project_json['issues'].first['epic']).not_to be_empty
it 'has epic_issue' do
expect(saved_project_json['issues'].first['epic_issue']).not_to be_empty
expect(saved_project_json['issues'].first['epic_issue']['id']).to eql(epic_issue.id)
end
it 'has issue epic id' do
expect(saved_project_json['issues'].first['epic']['id']).to eql(epic.id)
it 'has epic' do
expect(saved_project_json['issues'].first['epic_issue']['epic']['title']).to eql(epic.title)
end
it 'does not have epic_id' do
expect(saved_project_json['issues'].first['epic_issue']['epic_id']).to be_nil
end
it 'does not have issue_id' do
expect(saved_project_json['issues'].first['epic_issue']['issue_id']).to be_nil
end
end
end
......
......@@ -318,6 +318,9 @@ excluded_attributes:
- :state_id
- :start_date_sourcing_epic_id
- :due_date_sourcing_epic_id
epic_issue:
- :epic_id
- :issue_id
methods:
notes:
- :type
......@@ -370,7 +373,8 @@ ee:
- design_versions:
- actions:
- :design # Duplicate export of issues.designs in order to link the record to both Issue and Action
- :epic
- epic_issue:
- :epic
- protected_branches:
- :unprotect_access_levels
- protected_environments:
......
......@@ -205,36 +205,40 @@
"iid": 1,
"group_id": 100
},
"epic": {
"id": 1,
"group_id": 5,
"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-08T19:37:07.098Z",
"updated_at": "2019-12-08T19:43:11.568Z",
"title": "An epic",
"description": null,
"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_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"milestone_id": null
"epic_issue": {
"id": 78,
"relative_position": 1073740323,
"epic": {
"id": 1,
"group_id": 5,
"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-08T19:37:07.098Z",
"updated_at": "2019-12-08T19:43:11.568Z",
"title": "An epic",
"description": null,
"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_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"milestone_id": null
}
}
}
],
......
......@@ -606,3 +606,6 @@ epic:
- events
- resource_label_events
- user_mentions
epic_issue:
- epic
- issue
......@@ -832,3 +832,6 @@ Epic:
- start_date_sourcing_epic_id
- due_date_sourcing_epic_id
- health_status
EpicIssue:
- id
- relative_position
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