From c6e0228ca9937b10ad8e2620501d4fe221108d9a Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 4 Feb 2016 11:51:12 +0100 Subject: Hide remove source branch button when new commit is added to branch Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch --- app/models/merge_request.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 89b6c49b362..00362352508 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -284,7 +284,8 @@ class MergeRequest < ActiveRecord::Base def can_remove_source_branch?(current_user) !source_project.protected_branch?(source_branch) && !source_project.root_ref?(source_branch) && - Ability.abilities.allowed?(current_user, :push_code, source_project) + Ability.abilities.allowed?(current_user, :push_code, source_project) && + last_commit == source_project.commit(source_branch) end def mr_and_commit_notes -- cgit v1.2.1