From 900d30798b7eef1301978ff6f97b4cee7414b696 Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Wed, 28 May 2014 19:03:45 +0300
Subject: [PATCH] Use new Projects::TransferService class

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
---
 app/controllers/projects_controller.rb | 2 +-
 lib/api/groups.rb                      | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 07ccbd57fa..b9af36a0c7 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -44,7 +44,7 @@ class ProjectsController < ApplicationController
   end
 
   def transfer
-    ::Projects::TransferService.new(project, current_user, params).execute
+    ::Projects::TransferService.new(project, current_user, params[:project]).execute
   end
 
   def show
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 03f027706d..caa2ca97a3 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -87,10 +87,12 @@ module API
       #   POST /groups/:id/projects/:project_id
       post ":id/projects/:project_id" do
         authenticated_as_admin!
-        @group = Group.find(params[:id])
+        group = Group.find(params[:id])
         project = Project.find(params[:project_id])
-        if project.transfer(@group)
-          present @group
+        result = ::Projects::TransferService.new(project, current_user, namespace_id: group.id).execute
+
+        if result
+          present group
         else
           not_found!
         end
-- 
2.30.9