2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class ProjectMoved < PostPushMessage
|
2019-12-04 20:38:33 +05:30
|
|
|
REDIRECT_NAMESPACE = "redirect_namespace"
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
def initialize(repository, user, protocol, redirected_path)
|
2018-03-17 18:26:18 +05:30
|
|
|
@redirected_path = redirected_path
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
super(repository, user, protocol)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def message
|
2018-03-17 18:26:18 +05:30
|
|
|
<<~MESSAGE
|
|
|
|
Project '#{redirected_path}' was moved to '#{project.full_path}'.
|
|
|
|
|
|
|
|
Please update your Git remote:
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
git remote set-url origin #{url_to_repo}
|
2018-03-17 18:26:18 +05:30
|
|
|
MESSAGE
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
attr_reader :redirected_path
|
|
|
|
|
|
|
|
def self.message_key(user_id, project_id)
|
|
|
|
"#{REDIRECT_NAMESPACE}:#{user_id}:#{project_id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|