summaryrefslogtreecommitdiff
path: root/app/controllers/import
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 11:10:13 +0000
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /app/controllers/import
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
downloadgitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'app/controllers/import')
-rw-r--r--app/controllers/import/fogbugz_controller.rb14
-rw-r--r--app/controllers/import/gitea_controller.rb2
-rw-r--r--app/controllers/import/github_controller.rb2
3 files changed, 7 insertions, 11 deletions
diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb
index c223d9d211e..b949a99c250 100644
--- a/app/controllers/import/fogbugz_controller.rb
+++ b/app/controllers/import/fogbugz_controller.rb
@@ -44,7 +44,6 @@ class Import::FogbugzController < Import::BaseController
redirect_to status_import_fogbugz_path
end
- # rubocop: disable CodeReuse/ActiveRecord
def status
unless client.valid?
return redirect_to new_import_fogbugz_path
@@ -52,19 +51,18 @@ class Import::FogbugzController < Import::BaseController
super
end
- # rubocop: enable CodeReuse/ActiveRecord
def create
- repo = client.repo(params[:repo_id])
- fb_session = { uri: session[:fogbugz_uri], token: session[:fogbugz_token] }
+ credentials = { uri: session[:fogbugz_uri], token: session[:fogbugz_token] }
+
umap = session[:fogbugz_user_map] || client.user_map
- project = Gitlab::FogbugzImport::ProjectCreator.new(repo, fb_session, current_user.namespace, current_user, umap).execute
+ result = Import::FogbugzService.new(client, current_user, params.merge(umap: umap)).execute(credentials)
- if project.persisted?
- render json: ProjectSerializer.new.represent(project, serializer: :import)
+ if result[:status] == :success
+ render json: ProjectSerializer.new.represent(result[:project], serializer: :import)
else
- render json: { errors: project_save_error(project) }, status: :unprocessable_entity
+ render json: { errors: result[:message] }, status: result[:http_status]
end
end
diff --git a/app/controllers/import/gitea_controller.rb b/app/controllers/import/gitea_controller.rb
index 4b4ac07b389..399a92c59e0 100644
--- a/app/controllers/import/gitea_controller.rb
+++ b/app/controllers/import/gitea_controller.rb
@@ -7,7 +7,7 @@ class Import::GiteaController < Import::GithubController
def new
if session[access_token_key].present? && provider_url.present?
- redirect_to status_import_url
+ redirect_to status_import_url(namespace_id: params[:namespace_id])
end
end
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index 9bd8f893614..8dd40b6254e 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -76,12 +76,10 @@ class Import::GithubController < Import::BaseController
protected
- # rubocop: disable CodeReuse/ActiveRecord
override :importable_repos
def importable_repos
client_repos.to_a
end
- # rubocop: enable CodeReuse/ActiveRecord
override :incompatible_repos
def incompatible_repos