diff options
author | Phil Hughes <me@iamphill.com> | 2016-09-02 16:33:24 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-09-02 16:33:24 +0300 |
commit | 315e6392cd5f4e35fd44d0d24637ea377604b754 (patch) | |
tree | 58473e0dfbef1bf207ec51d19d2596ba032b78e5 /app/views/projects/branches | |
parent | a5d1428a91c16f07b73cf62401f9513db5fb85b7 (diff) |
Hides merge request button on branches page
If user does not have the correct permissions, the merge request button is hidden
Closes #21805
Diffstat (limited to 'app/views/projects/branches')
-rw-r--r-- | app/views/projects/branches/_branch.html.haml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 808e6b95746..5217b8bf028 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -3,6 +3,7 @@ - diverging_commit_counts = @repository.diverging_commit_counts(branch) - number_commits_behind = diverging_commit_counts[:behind] - number_commits_ahead = diverging_commit_counts[:ahead] +- merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project)) %li(class="js-branch-#{branch.name}") %div = link_to namespace_project_tree_path(@project.namespace, @project, branch.name), class: 'item-title str-truncated' do @@ -19,12 +20,12 @@ %i.fa.fa-lock protected .controls.hidden-xs - - if create_mr_button?(@repository.root_ref, branch.name) + - if merge_project && create_mr_button?(@repository.root_ref, branch.name) = link_to create_mr_path(@repository.root_ref, branch.name), class: 'btn btn-default' do Merge Request - if branch.name != @repository.root_ref - = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: branch.name), class: 'btn btn-default', method: :post, title: "Compare" do + = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: branch.name), class: "btn btn-default #{'prepend-left-10' unless merge_project}", method: :post, title: "Compare" do Compare = render 'projects/buttons/download', project: @project, ref: branch.name |