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 ProjectCreated < PostPushMessage
|
2019-12-04 20:38:33 +05:30
|
|
|
PROJECT_CREATED = "project_created"
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
def message
|
|
|
|
<<~MESSAGE
|
|
|
|
|
|
|
|
The private project #{project.full_path} was successfully created.
|
|
|
|
|
|
|
|
To configure the remote, run:
|
|
|
|
git remote add origin #{url_to_repo}
|
|
|
|
|
|
|
|
To view the project, visit:
|
|
|
|
#{project_url}
|
|
|
|
|
|
|
|
MESSAGE
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
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-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def project_url
|
|
|
|
Gitlab::Routing.url_helpers.project_url(project)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|