2018-10-11 20:12:21 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-08 17:42:43 +00:00
|
|
|
module Gitlab
|
|
|
|
module Checks
|
2018-02-02 15:27:30 +00:00
|
|
|
class ProjectMoved < PostPushMessage
|
2017-12-08 17:42:43 +00:00
|
|
|
REDIRECT_NAMESPACE = "redirect_namespace".freeze
|
|
|
|
|
2018-01-26 14:28:08 +00:00
|
|
|
def initialize(project, user, protocol, redirected_path)
|
2017-12-08 17:42:43 +00:00
|
|
|
@redirected_path = redirected_path
|
|
|
|
|
2018-01-26 14:28:08 +00:00
|
|
|
super(project, user, protocol)
|
2017-12-08 17:42:43 +00:00
|
|
|
end
|
|
|
|
|
2018-03-05 12:02:36 +00:00
|
|
|
def message
|
2018-02-02 15:27:30 +00:00
|
|
|
<<~MESSAGE
|
2017-12-08 17:42:43 +00:00
|
|
|
Project '#{redirected_path}' was moved to '#{project.full_path}'.
|
|
|
|
|
|
|
|
Please update your Git remote:
|
|
|
|
|
2018-03-05 12:02:36 +00:00
|
|
|
git remote set-url origin #{url_to_repo}
|
2017-12-08 17:42:43 +00:00
|
|
|
MESSAGE
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-01-26 14:28:08 +00:00
|
|
|
attr_reader :redirected_path
|
2017-12-08 17:42:43 +00:00
|
|
|
|
2018-01-26 14:28:08 +00:00
|
|
|
def self.message_key(user_id, project_id)
|
2017-12-25 13:33:32 +00:00
|
|
|
"#{REDIRECT_NAMESPACE}:#{user_id}:#{project_id}"
|
2017-12-08 17:42:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|