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,6 +374,7 @@ ee: ...@@ -371,6 +374,7 @@ 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_issue:
- :epic - :epic
- protected_branches: - protected_branches:
- :unprotect_access_levels - :unprotect_access_levels
......
...@@ -205,6 +205,9 @@ ...@@ -205,6 +205,9 @@
"iid": 1, "iid": 1,
"group_id": 100 "group_id": 100
}, },
"epic_issue": {
"id": 78,
"relative_position": 1073740323,
"epic": { "epic": {
"id": 1, "id": 1,
"group_id": 5, "group_id": 5,
...@@ -237,6 +240,7 @@ ...@@ -237,6 +240,7 @@
"milestone_id": null "milestone_id": null
} }
} }
}
], ],
"snippets": [ "snippets": [
......
...@@ -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