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-25 15:26:52 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-02-06 16:35:35 +0300
commite42a548f1dac02577d0c1731fef508dab68c45a5 (patch)
tree9781b82ec0da58683ebeb0fd0ba2062a9ce10e43 /lib/gitlab/checks
parentbc78ae6985ee37f9ac2ffc2dbf6f445078d16038 (diff)
Move new project on push logic to a service
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r--lib/gitlab/checks/project_created.rb (renamed from lib/gitlab/checks/new_project.rb)24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/gitlab/checks/new_project.rb b/lib/gitlab/checks/project_created.rb
index 488c5c03c32..f05e8b4a7e8 100644
--- a/lib/gitlab/checks/new_project.rb
+++ b/lib/gitlab/checks/project_created.rb
@@ -1,7 +1,7 @@
module Gitlab
module Checks
- class NewProject
- NEW_PROJECT = "new_project".freeze
+ class ProjectCreated
+ PROJECT_CREATED = "project_created".freeze
def initialize(user, project, protocol)
@user = user
@@ -9,26 +9,26 @@ module Gitlab
@protocol = protocol
end
- def self.fetch_new_project_message(user_id, project_id)
- new_project_key = new_project_message_key(user_id, project_id)
+ 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(new_project_key)
- redis.del(new_project_key)
+ message = redis.get(project_created_key)
+ redis.del(project_created_key)
message
end
end
- def add_new_project_message
+ def add_project_created_message
return unless user.present? && project.present?
Gitlab::Redis::SharedState.with do |redis|
- key = self.class.new_project_message_key(user.id, project.id)
- redis.setex(key, 5.minutes, new_project_message)
+ key = self.class.project_created_message_key(user.id, project.id)
+ redis.setex(key, 5.minutes, project_created_message)
end
end
- def new_project_message
+ def project_created_message
<<~MESSAGE.strip_heredoc
The private project #{project.full_path} was created.
@@ -46,8 +46,8 @@ module Gitlab
attr_reader :project, :user, :protocol
- def self.new_project_message_key(user_id, project_id)
- "#{NEW_PROJECT}:#{user_id}:#{project_id}"
+ def self.project_created_message_key(user_id, project_id)
+ "#{PROJECT_CREATED}:#{user_id}:#{project_id}"
end
def project_url