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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 21:18:33 +0300
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/controllers/import
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/controllers/import')
-rw-r--r--app/controllers/import/bulk_imports_controller.rb13
-rw-r--r--app/controllers/import/gitlab_groups_controller.rb7
2 files changed, 12 insertions, 8 deletions
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb
index ef32ba4d119..48635c933af 100644
--- a/app/controllers/import/bulk_imports_controller.rb
+++ b/app/controllers/import/bulk_imports_controller.rb
@@ -37,8 +37,13 @@ class Import::BulkImportsController < ApplicationController
end
def create
- result = BulkImportService.new(current_user, create_params, credentials).execute
- render json: result.to_json(only: [:id])
+ response = BulkImportService.new(current_user, create_params, credentials).execute
+
+ if response.success?
+ render json: response.payload.to_json(only: [:id])
+ else
+ render json: { error: response.message }, status: response.http_status
+ end
end
def realtime_changes
@@ -128,7 +133,7 @@ class Import::BulkImportsController < ApplicationController
rescue Gitlab::UrlBlocker::BlockedUrlError => e
clear_session_data
- redirect_to new_group_path, alert: _('Specified URL cannot be used: "%{reason}"') % { reason: e.message }
+ redirect_to new_group_path(anchor: 'import-group-pane'), alert: _('Specified URL cannot be used: "%{reason}"') % { reason: e.message }
end
def allow_local_requests?
@@ -151,7 +156,7 @@ class Import::BulkImportsController < ApplicationController
}, status: :unprocessable_entity
end
format.html do
- redirect_to new_group_path
+ redirect_to new_group_path(anchor: 'import-group-pane')
end
end
end
diff --git a/app/controllers/import/gitlab_groups_controller.rb b/app/controllers/import/gitlab_groups_controller.rb
index f68b76a7b36..503b10f766b 100644
--- a/app/controllers/import/gitlab_groups_controller.rb
+++ b/app/controllers/import/gitlab_groups_controller.rb
@@ -10,7 +10,7 @@ class Import::GitlabGroupsController < ApplicationController
def create
unless file_is_valid?(group_params[:file])
- return redirect_back_or_default(options: { alert: s_('GroupImport|Unable to process group import file') })
+ return redirect_to new_group_path(anchor: 'import-group-pane'), alert: s_('GroupImport|Unable to process group import file')
end
group_data = group_params.except(:file).merge(
@@ -30,9 +30,8 @@ class Import::GitlabGroupsController < ApplicationController
redirect_to group_path(group), alert: _("Group import could not be scheduled")
end
else
- redirect_back_or_default(
- options: { alert: s_("GroupImport|Group could not be imported: %{errors}") % { errors: group.errors.full_messages.to_sentence } }
- )
+ redirect_to new_group_path(anchor: 'import-group-pane'),
+ alert: s_("GroupImport|Group could not be imported: %{errors}") % { errors: group.errors.full_messages.to_sentence }
end
end