diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-25 12:26:52 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-06 13:35:35 +0000 |
commit | e42a548f1dac02577d0c1731fef508dab68c45a5 (patch) | |
tree | 9781b82ec0da58683ebeb0fd0ba2062a9ce10e43 /lib/api/internal.rb | |
parent | bc78ae6985ee37f9ac2ffc2dbf6f445078d16038 (diff) | |
download | gitlab-ce-e42a548f1dac02577d0c1731fef508dab68c45a5.tar.gz |
Move new project on push logic to a service
Diffstat (limited to 'lib/api/internal.rb')
-rw-r--r-- | lib/api/internal.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index b7475af2044..841a34eb67f 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -51,13 +51,11 @@ module API return { status: false, message: e.message } end - if user && project.blank? && receive_pack? - @project = ::Projects::CreateService.new(user, project_params).execute - - if @project.saved? - Gitlab::Checks::NewProject.new(user, @project, protocol).add_new_project_message - else - return { status: false, message: "Could not create project" } + if receive_pack? && project.blank? + begin + @project = ::Projects::CreateFromPushService.new(user, project_match[:project_path], project_namespace, protocol).execute + rescue Gitlab::GitAccess::ProjectCreationError => e + return { status: false, message: e.message } end end @@ -218,10 +216,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) + project_created_message = Gitlab::Checks::ProjectCreated.fetch_project_created_message(user.id, project.id) output[:redirected_message] = redirect_message if redirect_message - output[:new_project_message] = new_project_message if new_project_message + output[:project_created_message] = project_created_message if project_created_message end output |