2018-10-11 16:12:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-19 08:04:14 -05:00
|
|
|
module Gitlab
|
|
|
|
module Checks
|
2018-02-02 10:27:30 -05:00
|
|
|
class ProjectCreated < PostPushMessage
|
2019-08-31 15:25:25 -04:00
|
|
|
PROJECT_CREATED = "project_created"
|
2018-01-19 08:04:14 -05:00
|
|
|
|
2018-01-26 09:28:08 -05:00
|
|
|
def message
|
2018-02-02 10:27:30 -05:00
|
|
|
<<~MESSAGE
|
2018-01-19 08:04:14 -05:00
|
|
|
|
2018-02-02 10:27:30 -05:00
|
|
|
The private project #{project.full_path} was successfully created.
|
2018-01-19 08:04:14 -05:00
|
|
|
|
|
|
|
To configure the remote, run:
|
2018-01-26 09:28:08 -05:00
|
|
|
git remote add origin #{url_to_repo}
|
2018-01-19 08:04:14 -05:00
|
|
|
|
|
|
|
To view the project, visit:
|
|
|
|
#{project_url}
|
|
|
|
|
|
|
|
MESSAGE
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2021-06-22 11:06:55 -04:00
|
|
|
def self.message_key(user, repository)
|
|
|
|
"#{PROJECT_CREATED}:#{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
|
|
|
|
|
|
|
|
"#{PROJECT_CREATED}:#{user.id}:#{repository.project.id}"
|
2018-01-19 08:04:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def project_url
|
|
|
|
Gitlab::Routing.url_helpers.project_url(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|