Commit 8b24ee73 authored by Jeroen van Baarsen's avatar Jeroen van Baarsen
Browse files

Make sure the branch counter gets updated

When you delete a branch, the counters wont get updated automaticly,
this happends because of the JS nature of the original call. I've
fixed this by responding with a JS file, and recalculate the counters.

Fixes: #6030
parent 00c5feb46b0a
......@@ -23,7 +23,8 @@
end
def destroy
@branch = @repository.find_branch(params[:id])
DeleteBranchService.new.execute(project, params[:id], current_user)
respond_to do |format|
format.html { redirect_to project_branches_path(@project) }
......@@ -26,8 +27,8 @@
DeleteBranchService.new.execute(project, params[:id], current_user)
respond_to do |format|
format.html { redirect_to project_branches_path(@project) }
format.js { render nothing: true }
format.js
end
end
end
- commit = @repository.commit(branch.target)
%li
%li(class="js-branch-#{branch.name}")
%h4
= link_to project_tree_path(@project, branch.name) do
%strong= truncate(branch.name, length: 60)
......
: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}")
......@@ -9,7 +9,7 @@
= nav_link(html_options: {class: branches_tab_class}) do
= link_to project_branches_path(@project) do
Branches
%span.badge= @repository.branches.size
%span.badge.js-totalbranch-count= @repository.branches.size
= nav_link(controller: :tags) do
= link_to project_tags_path(@project) do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment