diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2014-09-21 10:29:52 +0200 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2014-09-21 11:43:05 +0200 |
commit | ad47993ac46cef672600f2384ee5fa2e661ec8be (patch) | |
tree | 07769b4efeb4c18762b3ed0e705179a5423926c1 /app/controllers/projects | |
parent | fda61a047ffb9b04bc4dd38e897088fde17fb3c1 (diff) | |
download | gitlab-ce-ad47993ac46cef672600f2384ee5fa2e661ec8be.tar.gz |
Factor error and success methods from services.
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/branches_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/projects/edit_tree_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/tags_controller.rb | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 6845fc5e6e6..faa0ce67ca8 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -17,10 +17,8 @@ class Projects::BranchesController < Projects::ApplicationController end def create - result = CreateBranchService.new.execute(project, - params[:branch_name], - params[:ref], - current_user) + result = CreateBranchService.new(project, current_user). + execute(params[:branch_name], params[:ref]) if result[:status] == :success @branch = result[:branch] redirect_to project_tree_path(@project, @branch.name) @@ -31,7 +29,7 @@ class Projects::BranchesController < Projects::ApplicationController end def destroy - DeleteBranchService.new.execute(project, params[:id], current_user) + DeleteBranchService.new(project, current_user).execute(params[:id]) @branch_name = params[:id] respond_to do |format| diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb index 72a41f771c0..8976d7c7be8 100644 --- a/app/controllers/projects/edit_tree_controller.rb +++ b/app/controllers/projects/edit_tree_controller.rb @@ -10,7 +10,8 @@ class Projects::EditTreeController < Projects::BaseTreeController end def update - result = Files::UpdateService.new(@project, current_user, params, @ref, @path).execute + result = Files::UpdateService. + new(@project, current_user, params, @ref, @path).execute if result[:status] == :success flash[:notice] = "Your changes have been successfully committed" diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb index c80ad8355d5..537c94bda20 100644 --- a/app/controllers/projects/tags_controller.rb +++ b/app/controllers/projects/tags_controller.rb @@ -13,9 +13,8 @@ class Projects::TagsController < Projects::ApplicationController end def create - result = CreateTagService.new.execute(@project, params[:tag_name], - params[:ref], params[:message], - current_user) + result = CreateTagService.new(@project, current_user). + execute(params[:tag_name], params[:ref], params[:message]) if result[:status] == :success @tag = result[:tag] redirect_to project_tags_path(@project) |