Commit 63b23470 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

MRs author can cancel automatic merge

parent 77f8a1e3
...@@ -150,7 +150,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -150,7 +150,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def cancel_merge_when_build_succeeds def cancel_merge_when_build_succeeds
return access_denied! unless @merge_request.can_be_merged_by?(current_user) unless @merge_request.can_be_merged_by?(current_user) || @merge_request.author == current_user
return access_denied!
end
if @merge_request.merge_when_build_succeeds? if @merge_request.merge_when_build_succeeds?
@merge_request.reset_merge_when_build_succeeds @merge_request.reset_merge_when_build_succeeds
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
= succeed '.' do = succeed '.' do
The changes will be merged into The changes will be merged into
%span.label-branch= @merge_request.target_branch %span.label-branch= @merge_request.target_branch
The source branch will not be removed. The source branch won't be removed.
- if remove_source_branch_button || @merge_request.can_be_merged_by?(current_user) - if remove_source_branch_button || @merge_request.can_be_merged_by?(current_user)
.clearfix.prepend-top-10 .clearfix.prepend-top-10
...@@ -22,6 +22,6 @@ ...@@ -22,6 +22,6 @@
= link_to merge_namespace_project_merge_request_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request, merge_when_build_succeeds: true, should_remove_source_branch: true), remote: true, method: :post, class: "btn btn-grouped btn-primary btn-sm remove_source_branch" do = link_to merge_namespace_project_merge_request_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request, merge_when_build_succeeds: true, should_remove_source_branch: true), remote: true, method: :post, class: "btn btn-grouped btn-primary btn-sm remove_source_branch" do
= icon('times') = icon('times')
Remove Source Branch When Merged Remove Source Branch When Merged
- if @merge_request.can_be_merged_by?(current_user) - if @merge_request.can_be_merged_by?(current_user) || @merge_request.author == current_user
= link_to merge_namespace_project_merge_request_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request), remote: true, method: :delete, class: "btn btn-grouped btn-warning btn-sm" do = link_to merge_namespace_project_merge_request_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request), remote: true, method: :delete, class: "btn btn-grouped btn-warning btn-sm" do
Cancel Automatic Merge Cancel Automatic Merge
Markdown is supported
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