diff --git a/app/controllers/import/manifest_controller.rb b/app/controllers/import/manifest_controller.rb index 0be9cc2468f..42e661325cf 100644 --- a/app/controllers/import/manifest_controller.rb +++ b/app/controllers/import/manifest_controller.rb @@ -47,7 +47,7 @@ class Import::ManifestController < Import::BaseController project[:id] == params[:repo_id].to_i end - project = Gitlab::ManifestImport::Importer.new(repository, group, current_user).execute + project = Gitlab::ManifestImport::ProjectCreator.new(repository, group, current_user).execute if project.persisted? render json: ProjectSerializer.new.represent(project) diff --git a/doc/user/project/import/img/manifest_upload.png b/doc/user/project/import/img/manifest_upload.png index 385df3aa8ce..ea68e7ffc6a 100644 Binary files a/doc/user/project/import/img/manifest_upload.png and b/doc/user/project/import/img/manifest_upload.png differ diff --git a/doc/user/project/import/manifest.md b/doc/user/project/import/manifest.md index 16c7e77d033..136ba310da1 100644 --- a/doc/user/project/import/manifest.md +++ b/doc/user/project/import/manifest.md @@ -10,7 +10,7 @@ You can do it by following next steps: 1. Click on the **Manifest file** button 1. Provide GitLab with a manifest xml file 1. Select a group you want to import to (you need to create a group first if you don't have one) -1. Click **Import projects** +1. Click **Continue to the next step** 1. You will be redirected to the import status page with projects list based on manifest file 1. Check the list and click 'Import all repositories' to start import. diff --git a/lib/gitlab/manifest_import/importer.rb b/lib/gitlab/manifest_import/project_creator.rb similarity index 73% rename from lib/gitlab/manifest_import/importer.rb rename to lib/gitlab/manifest_import/project_creator.rb index 8ffeb0a4143..9ccd32c3a3b 100644 --- a/lib/gitlab/manifest_import/importer.rb +++ b/lib/gitlab/manifest_import/project_creator.rb @@ -1,21 +1,15 @@ module Gitlab module ManifestImport - class Importer - attr_reader :repository, :destination, :user + class ProjectCreator + attr_reader :repository, :destination, :current_user - def initialize(repository, destination, user) + def initialize(repository, destination, current_user) @repository = repository @destination = destination - @user = user + @current_user = current_user end def execute - import_project - end - - private - - def import_project group_full_path, _, project_path = repository[:path].rpartition('/') group_full_path = File.join(destination.full_path, group_full_path) if destination group = Group.find_by_full_path(group_full_path) || @@ -30,16 +24,18 @@ module Gitlab visibility_level: destination.visibility_level } - Projects::CreateService.new(user, params).execute + Projects::CreateService.new(current_user, params).execute end + private + def create_group_with_parents(full_path) params = { group_path: full_path, visibility_level: destination.visibility_level } - Groups::NestedCreateService.new(user, params).execute + Groups::NestedCreateService.new(current_user, params).execute end end end diff --git a/spec/lib/gitlab/import_sources_spec.rb b/spec/lib/gitlab/import_sources_spec.rb index 7734f48de86..25827423914 100644 --- a/spec/lib/gitlab/import_sources_spec.rb +++ b/spec/lib/gitlab/import_sources_spec.rb @@ -50,7 +50,6 @@ describe Gitlab::ImportSources do fogbugz gitlab_project gitea - manifest ) expect(described_class.importer_names).to eq(expected) @@ -67,7 +66,7 @@ describe Gitlab::ImportSources do 'git' => nil, 'gitlab_project' => Gitlab::ImportExport::Importer, 'gitea' => Gitlab::LegacyGithubImport::Importer, - 'manifest' => Gitlab::ManifestImport::Importer + 'manifest' => nil } import_sources.each do |name, klass| diff --git a/spec/lib/gitlab/manifest_import/importer_spec.rb b/spec/lib/gitlab/manifest_import/project_creator_spec.rb similarity index 93% rename from spec/lib/gitlab/manifest_import/importer_spec.rb rename to spec/lib/gitlab/manifest_import/project_creator_spec.rb index 55f3c347386..1d01d437535 100644 --- a/spec/lib/gitlab/manifest_import/importer_spec.rb +++ b/spec/lib/gitlab/manifest_import/project_creator_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Gitlab::ManifestImport::Importer, :postgresql do +describe Gitlab::ManifestImport::ProjectCreator, :postgresql do let(:group) { create(:group) } let(:user) { create(:user) } let(:repository) do