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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-01-26 17:28:08 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 16:35:35 +0300
commitdc229c076cdc0ef6e7f3f74f6e462c22880ff08c (patch)
treeec2c979bf3dcb0af71661a7903afd02b2e6f6114 /lib/gitlab/checks/project_created.rb
parente42a548f1dac02577d0c1731fef508dab68c45a5 (diff)
Abstracts ProjectMoved and ProjectCreated into a BaseProject
Diffstat (limited to 'lib/gitlab/checks/project_created.rb')
-rw-r--r--lib/gitlab/checks/project_created.rb39
1 files changed, 4 insertions, 35 deletions
diff --git a/lib/gitlab/checks/project_created.rb b/lib/gitlab/checks/project_created.rb
index f05e8b4a7e8..bd1e204bc81 100644
--- a/lib/gitlab/checks/project_created.rb
+++ b/lib/gitlab/checks/project_created.rb
@@ -1,40 +1,15 @@
module Gitlab
module Checks
- class ProjectCreated
+ class ProjectCreated < BaseProject
PROJECT_CREATED = "project_created".freeze
- def initialize(user, project, protocol)
- @user = user
- @project = project
- @protocol = protocol
- end
-
- def self.fetch_project_created_message(user_id, project_id)
- project_created_key = project_created_message_key(user_id, project_id)
-
- Gitlab::Redis::SharedState.with do |redis|
- message = redis.get(project_created_key)
- redis.del(project_created_key)
- message
- end
- end
-
- def add_project_created_message
- return unless user.present? && project.present?
-
- Gitlab::Redis::SharedState.with do |redis|
- key = self.class.project_created_message_key(user.id, project.id)
- redis.setex(key, 5.minutes, project_created_message)
- end
- end
-
- def project_created_message
+ def message
<<~MESSAGE.strip_heredoc
The private project #{project.full_path} was created.
To configure the remote, run:
- git remote add origin #{git_url}
+ git remote add origin #{url_to_repo}
To view the project, visit:
#{project_url}
@@ -44,19 +19,13 @@ module Gitlab
private
- attr_reader :project, :user, :protocol
-
- def self.project_created_message_key(user_id, project_id)
+ def self.message_key(user_id, project_id)
"#{PROJECT_CREATED}:#{user_id}:#{project_id}"
end
def project_url
Gitlab::Routing.url_helpers.project_url(project)
end
-
- def git_url
- protocol == 'ssh' ? project.ssh_url_to_repo : project.http_url_to_repo
- end
end
end
end