From 004da305db20f554a504daed8f44d5765aaa9a0c Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Fri, 22 Sep 2017 11:51:17 -0300 Subject: Project import fix --- lib/gitlab/import_export/project_tree_restorer.rb | 2 +- spec/lib/gitlab/import_export/project.light.json | 26 +++++++++++++++++++++- .../import_export/project_tree_restorer_spec.rb | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb index 3bc095a99a9..ec49b9d960e 100644 --- a/lib/gitlab/import_export/project_tree_restorer.rb +++ b/lib/gitlab/import_export/project_tree_restorer.rb @@ -2,7 +2,7 @@ module Gitlab module ImportExport class ProjectTreeRestorer # Relations which cannot have both group_id and project_id at the same time - RESTRICT_PROJECT_AND_GROUP = %i(milestones).freeze + RESTRICT_PROJECT_AND_GROUP = %i(milestones milestone group_milestones group_milestone).freeze def initialize(user:, shared:, project:) @path = File.join(shared.export_path, 'project.json') diff --git a/spec/lib/gitlab/import_export/project.light.json b/spec/lib/gitlab/import_export/project.light.json index 2d8f3d4a566..e3e7d1bda54 100644 --- a/spec/lib/gitlab/import_export/project.light.json +++ b/spec/lib/gitlab/import_export/project.light.json @@ -106,7 +106,31 @@ "priorities": [] } } - ] + ], + "milestone":{ + "id": 1, + "title": "test milestone", + "project_id": 8, + "description": "test milestone", + "due_date": null, + "created_at": "2016-06-14T15:02:04.415Z", + "updated_at": "2016-06-14T15:02:04.415Z", + "state": "active", + "iid": 1, + "group_id": null, + "events":[ + { + "id":10, + "project_id":8, + "author_id":1, + "target_id":1, + "created_at":"2017-08-10T19:56:03.091Z", + "updated_at":"2017-08-10T19:56:03.091Z", + "target_type":"Milestone", + "action":1 + } + ] + } } ], "snippets": [ diff --git a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb index efe11ca794a..ac1423b2936 100644 --- a/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/project_tree_restorer_spec.rb @@ -253,9 +253,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do expect(project.milestones.count).to eq(1) end - it 'has issue' do + it 'has issue with milestone' do expect(project.issues.count).to eq(1) expect(project.issues.first.labels.count).to eq(2) + expect(project.issues.first.milestone).to be_present end it 'has issue with group label and project label' do -- cgit v1.2.3