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-06-22 18:06:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-22 18:06:55 +0300
commit793034a90509193ebf2ad14ed8e5eea10f7c6b4a (patch)
treec6326ec316c71dad77ab8f40b4eedf5093544403 /lib/gitlab/checks/container_moved.rb
parente2d00f9148a5c87fe4f56e4fd3c90a9b3574f03b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/checks/container_moved.rb')
-rw-r--r--lib/gitlab/checks/container_moved.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/gitlab/checks/container_moved.rb b/lib/gitlab/checks/container_moved.rb
new file mode 100644
index 00000000000..41180bbf246
--- /dev/null
+++ b/lib/gitlab/checks/container_moved.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Checks
+ class ContainerMoved < PostPushMessage
+ REDIRECT_NAMESPACE = "redirect_namespace"
+
+ def initialize(repository, user, protocol, redirected_path)
+ @redirected_path = redirected_path
+
+ super(repository, user, protocol)
+ end
+
+ def message
+ <<~MESSAGE
+ #{container.class.model_name.human} '#{redirected_path}' was moved to '#{container.full_path}'.
+
+ Please update your Git remote:
+
+ git remote set-url origin #{url_to_repo}
+ MESSAGE
+ end
+
+ private
+
+ attr_reader :redirected_path
+
+ def self.message_key(user, repository)
+ "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.gl_repository}"
+ end
+
+ # TODO: Remove in the next release
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/292030
+ def self.legacy_message_key(user, repository)
+ return unless repository.project
+
+ "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.project.id}"
+ end
+ end
+ end
+end