diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-22 22:00:11 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-22 22:00:11 +0400 |
commit | db12e2dc8d70536af1a886162cb19705d458f560 (patch) | |
tree | 27f3e2014a6bf2fdd31a639a639b07ae924eec07 /app/controllers | |
parent | ed9a6bf99c1abf261147956ec613211419b63ea5 (diff) | |
parent | ad47993ac46cef672600f2384ee5fa2e661ec8be (diff) |
Merge pull request #7807 from cirosantilli/factor-service-error
Factor error and success methods from services.
Diffstat (limited to 'app/controllers')
-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) |