Commit e089b11b7a4026acc7706e519682f4b7141b2bcd
1 parent
88781783
Exists in
spb-stable
and in
2 other branches
Add BranchesHelper
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
11 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
| 1 | +module BranchesHelper | ||
| 2 | + def can_remove_branch?(project, branch_name) | ||
| 3 | + if project.protected_branch? branch_name | ||
| 4 | + false | ||
| 5 | + elsif branch_name == project.repository.root_ref | ||
| 6 | + false | ||
| 7 | + else | ||
| 8 | + can?(current_user, :push_code, project) | ||
| 9 | + end | ||
| 10 | + end | ||
| 11 | +end |