Commit f155fc16 authored by Micaël Bergeron's avatar Micaël Bergeron

fix the approvals_before_merge project fallback

the param :target_project_id is only sent when creating the MR.
upon an update, the @merge_request.target_project will be used.
parent 1ab15ba2
......@@ -36,8 +36,13 @@ module EE
def clamp_approvals_before_merge(mr_params)
return mr_params unless mr_params[:approvals_before_merge]
target_project = @project.forked_from_project if @project.id.to_s != mr_params[:target_project_id]
target_project ||= @project
target_project = if @merge_request
@merge_request.target_project
elsif @project.id.to_s != mr_params[:target_project_id]
@project.forked_from_project
else
@project
end
if mr_params[:approvals_before_merge].to_i <= target_project.approvals_before_merge
mr_params[:approvals_before_merge] = nil
......
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