Commit af7e7516 authored by Timothy Andrew's avatar Timothy Andrew

Don't ask the user to "merge this request manually".

1. If they are a developer with "Developers can Merge" switched on.
parent 959d63ab
...@@ -556,6 +556,11 @@ class MergeRequest < ActiveRecord::Base ...@@ -556,6 +556,11 @@ class MergeRequest < ActiveRecord::Base
access.can_push_to_branch?(target_branch) || access.can_merge_to_branch?(target_branch) access.can_push_to_branch?(target_branch) || access.can_merge_to_branch?(target_branch)
end end
def can_be_merged_via_command_line_by?(user)
access = ::Gitlab::UserAccess.new(user, project: project)
access.can_push_to_branch?(target_branch)
end
def mergeable_ci_state? def mergeable_ci_state?
return true unless project.only_allow_merge_if_build_succeeds? return true unless project.only_allow_merge_if_build_succeeds?
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
%p %p
Please resolve these conflicts or Please resolve these conflicts or
- if @merge_request.can_be_merged_by?(current_user) - if @merge_request.can_be_merged_via_command_line_by?(current_user)
#{link_to "merge this request manually", "#modal_merge_info", class: "how_to_merge_link vlink", "data-toggle" => "modal"}. #{link_to "merge this request manually", "#modal_merge_info", class: "how_to_merge_link vlink", "data-toggle" => "modal"}.
- else - else
ask someone with write access to this repository to merge this request manually. ask someone with write access to this repository to merge this request manually.
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