Class: Gitlab::Checks::ContainerMoved

Inherits:
PostPushMessage show all
Defined in:
lib/gitlab/checks/container_moved.rb

Constant Summary collapse

REDIRECT_NAMESPACE =
"redirect_namespace"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PostPushMessage

#add_message, fetch_message

Constructor Details

#initialize(repository, user, protocol, redirected_path) ⇒ ContainerMoved

Returns a new instance of ContainerMoved.



8
9
10
11
12
# File 'lib/gitlab/checks/container_moved.rb', line 8

def initialize(repository, user, protocol, redirected_path)
  @redirected_path = redirected_path

  super(repository, user, protocol)
end

Class Method Details

.legacy_message_key(user, repository) ⇒ Object

TODO: Remove in the next release gitlab.com/gitlab-org/gitlab/-/issues/292030



34
35
36
37
38
# File 'lib/gitlab/checks/container_moved.rb', line 34

def self.legacy_message_key(user, repository)
  return unless repository.project

  "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.project.id}"
end

.message_key(user, repository) ⇒ Object



28
29
30
# File 'lib/gitlab/checks/container_moved.rb', line 28

def self.message_key(user, repository)
  "#{REDIRECT_NAMESPACE}:#{user.id}:#{repository.gl_repository}"
end

Instance Method Details

#messageObject



14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/checks/container_moved.rb', line 14

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