diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /app/services/groups | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/services/groups')
-rw-r--r-- | app/services/groups/deploy_tokens/create_service.rb | 6 | ||||
-rw-r--r-- | app/services/groups/import_export/import_service.rb | 10 | ||||
-rw-r--r-- | app/services/groups/transfer_service.rb | 22 |
3 files changed, 19 insertions, 19 deletions
diff --git a/app/services/groups/deploy_tokens/create_service.rb b/app/services/groups/deploy_tokens/create_service.rb index 81f761eb61d..aee423659ef 100644 --- a/app/services/groups/deploy_tokens/create_service.rb +++ b/app/services/groups/deploy_tokens/create_service.rb @@ -8,11 +8,7 @@ module Groups def execute deploy_token = create_deploy_token_for(@group, params) - if deploy_token.persisted? - success(deploy_token: deploy_token, http_status: :created) - else - error(deploy_token.errors.full_messages.to_sentence, :bad_request) - end + create_deploy_token_payload_for(deploy_token) end end end diff --git a/app/services/groups/import_export/import_service.rb b/app/services/groups/import_export/import_service.rb index 548a4a98dc1..f62b9d3c8a6 100644 --- a/app/services/groups/import_export/import_service.rb +++ b/app/services/groups/import_export/import_service.rb @@ -33,10 +33,12 @@ module Groups end def restorer - @restorer ||= Gitlab::ImportExport::Group::TreeRestorer.new(user: @current_user, - shared: @shared, - group: @group, - group_hash: nil) + @restorer ||= Gitlab::ImportExport::Group::LegacyTreeRestorer.new( + user: @current_user, + shared: @shared, + group: @group, + group_hash: nil + ) end def remove_import_file diff --git a/app/services/groups/transfer_service.rb b/app/services/groups/transfer_service.rb index 4e7875e0491..fe3ab884302 100644 --- a/app/services/groups/transfer_service.rb +++ b/app/services/groups/transfer_service.rb @@ -2,15 +2,6 @@ module Groups class TransferService < Groups::BaseService - ERROR_MESSAGES = { - database_not_supported: s_('TransferGroup|Database is not supported.'), - namespace_with_same_path: s_('TransferGroup|The parent group already has a subgroup with the same path.'), - group_is_already_root: s_('TransferGroup|Group is already a root group.'), - same_parent_as_current: s_('TransferGroup|Group is already associated to the parent group.'), - invalid_policies: s_("TransferGroup|You don't have enough permissions."), - group_contains_images: s_('TransferGroup|Cannot update the path because there are projects under this group that contain Docker images in their Container Registry. Please remove the images from your projects first and try again.') - }.freeze - TransferError = Class.new(StandardError) attr_reader :error, :new_parent_group @@ -124,7 +115,18 @@ module Groups end def raise_transfer_error(message) - raise TransferError, ERROR_MESSAGES[message] + raise TransferError, localized_error_messages[message] + end + + def localized_error_messages + { + database_not_supported: s_('TransferGroup|Database is not supported.'), + namespace_with_same_path: s_('TransferGroup|The parent group already has a subgroup with the same path.'), + group_is_already_root: s_('TransferGroup|Group is already a root group.'), + same_parent_as_current: s_('TransferGroup|Group is already associated to the parent group.'), + invalid_policies: s_("TransferGroup|You don't have enough permissions."), + group_contains_images: s_('TransferGroup|Cannot update the path because there are projects under this group that contain Docker images in their Container Registry. Please remove the images from your projects first and try again.') + }.freeze end end end |