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