Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_created.rb « checks « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ea3be883be6acbdf56d783f5f57faa209c008752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

module Gitlab
  module Checks
    class ProjectCreated < PostPushMessage
      PROJECT_CREATED = "project_created"

      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

      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}"
      end

      def project_url
        Gitlab::Routing.url_helpers.project_url(project)
      end
    end
  end
end