summaryrefslogtreecommitdiff
path: root/app/services/projects/transfer_service.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /app/services/projects/transfer_service.rb
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/services/projects/transfer_service.rb')
-rw-r--r--app/services/projects/transfer_service.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/services/projects/transfer_service.rb b/app/services/projects/transfer_service.rb
index 60e5b7e2639..0fb70feec86 100644
--- a/app/services/projects/transfer_service.rb
+++ b/app/services/projects/transfer_service.rb
@@ -55,10 +55,18 @@ module Projects
raise TransferError.new(s_('TransferProject|Project cannot be transferred, because tags are present in its container registry'))
end
+ if project.has_packages?(:npm) && !new_namespace_has_same_root?(project)
+ raise TransferError.new(s_("TransferProject|Root namespace can't be updated if project has NPM packages"))
+ end
+
attempt_transfer_transaction
end
# rubocop: enable CodeReuse/ActiveRecord
+ def new_namespace_has_same_root?(project)
+ new_namespace.root_ancestor == project.namespace.root_ancestor
+ end
+
def attempt_transfer_transaction
Project.transaction do
project.expire_caches_before_rename(@old_path)