Commit f93d656d authored by James Lopez's avatar James Lopez

Merge branch 'georgekoltsov/fix-epic-issues' into 'master'

Fix issues missing on epic's page after project import

See merge request gitlab-org/gitlab!26099
parents 866e3b96 b9b41ff5
---
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 ...@@ -18,6 +18,7 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
end end
context 'with group' do context 'with group' do
let(:issue) { project.issues.find_by_title('Issue with Epic') }
let!(:project) do let!(:project) do
create(:project, create(:project,
:builds_disabled, :builds_disabled,
...@@ -35,7 +36,8 @@ describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -35,7 +36,8 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect { restored_project_json }.not_to change { Epic.count } expect { restored_project_json }.not_to change { Epic.count }
expect(project.group.epics.count).to eq(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).to eq(epic)
expect(issue.epic_issue.relative_position).not_to be_nil
end end
end end
...@@ -45,7 +47,9 @@ describe Gitlab::ImportExport::Project::TreeRestorer do ...@@ -45,7 +47,9 @@ describe Gitlab::ImportExport::Project::TreeRestorer do
expect { restored_project_json }.to change { Epic.count }.from(0).to(1) expect { restored_project_json }.to change { Epic.count }.from(0).to(1)
expect(project.group.epics.count).to eq(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 end
end end
......
...@@ -60,12 +60,21 @@ describe Gitlab::ImportExport::Project::TreeSaver do ...@@ -60,12 +60,21 @@ describe Gitlab::ImportExport::Project::TreeSaver do
end end
context 'epics' do context 'epics' do
it 'has issue epic' do it 'has epic_issue' do
expect(saved_project_json['issues'].first['epic']).not_to be_empty 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 end
it 'has issue epic id' do it 'has epic' do
expect(saved_project_json['issues'].first['epic']['id']).to eql(epic.id) 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 end
end end
......
...@@ -319,6 +319,9 @@ excluded_attributes: ...@@ -319,6 +319,9 @@ excluded_attributes:
- :state_id - :state_id
- :start_date_sourcing_epic_id - :start_date_sourcing_epic_id
- :due_date_sourcing_epic_id - :due_date_sourcing_epic_id
epic_issue:
- :epic_id
- :issue_id
methods: methods:
notes: notes:
- :type - :type
...@@ -371,7 +374,8 @@ ee: ...@@ -371,7 +374,8 @@ ee:
- design_versions: - design_versions:
- actions: - actions:
- :design # Duplicate export of issues.designs in order to link the record to both Issue and Action - :design # Duplicate export of issues.designs in order to link the record to both Issue and Action
- :epic - epic_issue:
- :epic
- protected_branches: - protected_branches:
- :unprotect_access_levels - :unprotect_access_levels
- protected_environments: - protected_environments:
......
...@@ -205,36 +205,40 @@ ...@@ -205,36 +205,40 @@
"iid": 1, "iid": 1,
"group_id": 100 "group_id": 100
}, },
"epic": { "epic_issue": {
"id": 1, "id": 78,
"group_id": 5, "relative_position": 1073740323,
"author_id": 1, "epic": {
"assignee_id": null, "id": 1,
"iid": 1, "group_id": 5,
"updated_by_id": null, "author_id": 1,
"last_edited_by_id": null, "assignee_id": null,
"lock_version": 0, "iid": 1,
"start_date": null, "updated_by_id": null,
"end_date": null, "last_edited_by_id": null,
"last_edited_at": null, "lock_version": 0,
"created_at": "2019-12-08T19:37:07.098Z", "start_date": null,
"updated_at": "2019-12-08T19:43:11.568Z", "end_date": null,
"title": "An epic", "last_edited_at": null,
"description": null, "created_at": "2019-12-08T19:37:07.098Z",
"start_date_sourcing_milestone_id": null, "updated_at": "2019-12-08T19:43:11.568Z",
"due_date_sourcing_milestone_id": null, "title": "An epic",
"start_date_fixed": null, "description": null,
"due_date_fixed": null, "start_date_sourcing_milestone_id": null,
"start_date_is_fixed": null, "due_date_sourcing_milestone_id": null,
"due_date_is_fixed": null, "start_date_fixed": null,
"closed_by_id": null, "due_date_fixed": null,
"closed_at": null, "start_date_is_fixed": null,
"parent_id": null, "due_date_is_fixed": null,
"relative_position": null, "closed_by_id": null,
"state_id": "opened", "closed_at": null,
"start_date_sourcing_epic_id": null, "parent_id": null,
"due_date_sourcing_epic_id": null, "relative_position": null,
"milestone_id": null "state_id": "opened",
"start_date_sourcing_epic_id": null,
"due_date_sourcing_epic_id": null,
"milestone_id": null
}
} }
} }
], ],
......
...@@ -609,3 +609,6 @@ epic: ...@@ -609,3 +609,6 @@ epic:
- events - events
- resource_label_events - resource_label_events
- user_mentions - user_mentions
epic_issue:
- epic
- issue
...@@ -832,3 +832,6 @@ Epic: ...@@ -832,3 +832,6 @@ Epic:
- start_date_sourcing_epic_id - start_date_sourcing_epic_id
- due_date_sourcing_epic_id - due_date_sourcing_epic_id
- health_status - 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