diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-19 13:04:14 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-06 13:35:35 +0000 |
commit | 32b2ff26011a5274bdb8a3dd41ad360a67c3148a (patch) | |
tree | 56064e3de4e9ca505730bdf1af3597ba8ead499f /lib/api/internal.rb | |
parent | 35882e681b681f68a818bda9a8d2624edfecc219 (diff) | |
download | gitlab-ce-32b2ff26011a5274bdb8a3dd41ad360a67c3148a.tar.gz |
Adds remote messsage when project is created in a push over SSH or HTTP
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r-- | lib/api/internal.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index a83f714a1f3..f641ef457a3 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -43,7 +43,7 @@ module API access_checker_klass = wiki? ? Gitlab::GitAccessWiki : Gitlab::GitAccess access_checker = access_checker_klass - .new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities, redirected_path: redirected_path, target_namespace: user.namespace) + .new(actor, project, protocol, authentication_abilities: ssh_authentication_abilities, redirected_path: redirected_path, target_namespace: namespace) begin access_checker.check(params[:action], params[:changes]) @@ -51,17 +51,21 @@ module API return { status: false, message: e.message } end - if project.blank? && params[:action] == 'git-receive-pack' + if user && project.blank? && receive_pack? project_params = { description: "", - path: params[:project].split('/').last.gsub("\.git", ''), - namespace_id: user.namespace.id.to_s, + path: Project.parse_project_id(project_match[:project_name]), + namespace_id: namespace&.id, visibility_level: Gitlab::VisibilityLevel::PRIVATE.to_s } @project = ::Projects::CreateService.new(user, project_params).execute - return { status: false, message: "Could not create project" } unless @project.saved? + if @project.saved? + Gitlab::Checks::NewProject.new(user, @project, protocol).add_new_project_message + else + return { status: false, message: "Could not create project" } + end end log_user_activity(actor) @@ -221,7 +225,10 @@ module API # key could be used if user redirect_message = Gitlab::Checks::ProjectMoved.fetch_redirect_message(user.id, project.id) + new_project_message = Gitlab::Checks::NewProject.fetch_new_project_message(user.id, project.id) + output[:redirected_message] = redirect_message if redirect_message + output[:new_project_message] = new_project_message if new_project_message end output |