Commit dbe5012f authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'kassio/bulkimports-better-destination-validation-error-message' into 'master'

Better error message when import fails due to backend validation

See merge request gitlab-org/gitlab!54827
parents 2780d752 c807039b
...@@ -118,8 +118,8 @@ class BulkImports::Entity < ApplicationRecord ...@@ -118,8 +118,8 @@ class BulkImports::Entity < ApplicationRecord
if source.self_and_descendants.any? { |namespace| namespace.full_path == destination_namespace } if source.self_and_descendants.any? { |namespace| namespace.full_path == destination_namespace }
errors.add( errors.add(
:destination_namespace, :base,
s_('BulkImport|destination group cannot be part of the source group tree') s_('BulkImport|Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again.')
) )
end end
end end
......
---
title: Better error message when import fails due to backend validation
merge_request: 54827
author:
type: changed
...@@ -5095,6 +5095,9 @@ msgstr "" ...@@ -5095,6 +5095,9 @@ msgstr ""
msgid "BulkImport|From source group" msgid "BulkImport|From source group"
msgstr "" msgstr ""
msgid "BulkImport|Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again."
msgstr ""
msgid "BulkImport|Import groups from GitLab" msgid "BulkImport|Import groups from GitLab"
msgstr "" msgstr ""
...@@ -5122,9 +5125,6 @@ msgstr "" ...@@ -5122,9 +5125,6 @@ msgstr ""
msgid "BulkImport|You have no groups to import" msgid "BulkImport|You have no groups to import"
msgstr "" msgstr ""
msgid "BulkImport|destination group cannot be part of the source group tree"
msgstr ""
msgid "BulkImport|expected an associated Group but has an associated Project" msgid "BulkImport|expected an associated Group but has an associated Project"
msgstr "" msgstr ""
......
...@@ -103,7 +103,9 @@ RSpec.describe BulkImports::Entity, type: :model do ...@@ -103,7 +103,9 @@ RSpec.describe BulkImports::Entity, type: :model do
) )
expect(entity).not_to be_valid expect(entity).not_to be_valid
expect(entity.errors).to include(:destination_namespace) expect(entity.errors).to include(:base)
expect(entity.errors[:base])
.to include('Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again.')
end end
it 'is invalid if destination namespace is a descendant of the source' do it 'is invalid if destination namespace is a descendant of the source' do
...@@ -118,7 +120,8 @@ RSpec.describe BulkImports::Entity, type: :model do ...@@ -118,7 +120,8 @@ RSpec.describe BulkImports::Entity, type: :model do
) )
expect(entity).not_to be_valid expect(entity).not_to be_valid
expect(entity.errors).to include(:destination_namespace) expect(entity.errors[:base])
.to include('Import failed: Destination cannot be a subgroup of the source group. Change the destination and try again.')
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment