diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index a3ff8b91ea2b0d220b94fcf6a195e7c4821eb365..3c8e7ec73f6dedf53d9719d6bda430476cd8e902 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -23,8 +23,8 @@ class Projects::BranchesController < Projects::ApplicationController end def destroy - @branch = @repository.find_branch(params[:id]) DeleteBranchService.new.execute(project, params[:id], current_user) + @branch_name = params[:id] respond_to do |format| format.html { redirect_to project_branches_path(@project) } diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml index 2cba6d37452c3c2399ed42e99573b14cb23adb60..ec1661c0aaae9558fa3d193a84dc675fe0233c7f 100644 --- a/app/views/projects/branches/destroy.js.haml +++ b/app/views/projects/branches/destroy.js.haml @@ -1,5 +1,3 @@ :plain - $(".js-branch-#{@branch.name}").remove(); - $('.js-recentbranch-count').html("#{@repository.recent_branches.count}") - $('.js-protectedbranch-count').html("#{@project.protected_branches.count}") - $('.js-totalbranch-count').html("#{@repository.branch_names.count}") + $(".js-branch-#{@branch_name}").remove(); + $('.js-totalbranch-count').html("#{@repository.branches.size}")