Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2018-06-06 14:41:22 +0300
committerFatih Acet <acetfatih@gmail.com>2018-06-06 14:41:22 +0300
commitddabde5446a68d4717ed8d42431a480c7a68a8a9 (patch)
treede66cd119db386b8ec6e8e1d5e387acddb3bf68b /app/controllers
parentb995b0319147a068092afc21fc2f1f3ff044a143 (diff)
parent332275b766283ff65d0637ada3e4080c3cd4f038 (diff)
Merge branch 'sh-improve-import-status-error' into 'master'
Show a more helpful error for import status Closes #47365 See merge request gitlab-org/gitlab-ce!19467
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/import/base_controller.rb4
-rw-r--r--app/controllers/import/bitbucket_controller.rb2
-rw-r--r--app/controllers/import/fogbugz_controller.rb2
-rw-r--r--app/controllers/import/github_controller.rb2
-rw-r--r--app/controllers/import/gitlab_controller.rb2
-rw-r--r--app/controllers/import/google_code_controller.rb2
6 files changed, 9 insertions, 5 deletions
diff --git a/app/controllers/import/base_controller.rb b/app/controllers/import/base_controller.rb
index 663269a0f92..5766c6924cd 100644
--- a/app/controllers/import/base_controller.rb
+++ b/app/controllers/import/base_controller.rb
@@ -25,4 +25,8 @@ class Import::BaseController < ApplicationController
current_user.namespace
end
+
+ def project_save_error(project)
+ project.errors.full_messages.join(', ')
+ end
end
diff --git a/app/controllers/import/bitbucket_controller.rb b/app/controllers/import/bitbucket_controller.rb
index 77af5fb9c4f..fa31933e778 100644
--- a/app/controllers/import/bitbucket_controller.rb
+++ b/app/controllers/import/bitbucket_controller.rb
@@ -55,7 +55,7 @@ class Import::BitbucketController < Import::BaseController
if project.persisted?
render json: ProjectSerializer.new.represent(project)
else
- render json: { errors: project.errors.full_messages }, status: :unprocessable_entity
+ render json: { errors: project_save_error(project) }, status: :unprocessable_entity
end
else
render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity
diff --git a/app/controllers/import/fogbugz_controller.rb b/app/controllers/import/fogbugz_controller.rb
index 25ec13b8075..2d665e05ac3 100644
--- a/app/controllers/import/fogbugz_controller.rb
+++ b/app/controllers/import/fogbugz_controller.rb
@@ -66,7 +66,7 @@ class Import::FogbugzController < Import::BaseController
if project.persisted?
render json: ProjectSerializer.new.represent(project)
else
- render json: { errors: project.errors.full_messages }, status: :unprocessable_entity
+ render json: { errors: project_save_error(project) }, status: :unprocessable_entity
end
end
diff --git a/app/controllers/import/github_controller.rb b/app/controllers/import/github_controller.rb
index f67ec4c248b..c9870332c0f 100644
--- a/app/controllers/import/github_controller.rb
+++ b/app/controllers/import/github_controller.rb
@@ -48,7 +48,7 @@ class Import::GithubController < Import::BaseController
if project.persisted?
render json: ProjectSerializer.new.represent(project)
else
- render json: { errors: project.errors.full_messages }, status: :unprocessable_entity
+ render json: { errors: project_save_error(project) }, status: :unprocessable_entity
end
else
render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity
diff --git a/app/controllers/import/gitlab_controller.rb b/app/controllers/import/gitlab_controller.rb
index 39e2e9e094b..fccbdbca0f6 100644
--- a/app/controllers/import/gitlab_controller.rb
+++ b/app/controllers/import/gitlab_controller.rb
@@ -32,7 +32,7 @@ class Import::GitlabController < Import::BaseController
if project.persisted?
render json: ProjectSerializer.new.represent(project)
else
- render json: { errors: project.errors.full_messages }, status: :unprocessable_entity
+ render json: { errors: project_save_error(project) }, status: :unprocessable_entity
end
else
render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity
diff --git a/app/controllers/import/google_code_controller.rb b/app/controllers/import/google_code_controller.rb
index 9b26a00f7c7..3bce27e810a 100644
--- a/app/controllers/import/google_code_controller.rb
+++ b/app/controllers/import/google_code_controller.rb
@@ -92,7 +92,7 @@ class Import::GoogleCodeController < Import::BaseController
if project.persisted?
render json: ProjectSerializer.new.represent(project)
else
- render json: { errors: project.errors.full_messages }, status: :unprocessable_entity
+ render json: { errors: project_save_error(project) }, status: :unprocessable_entity
end
end