Fix MR creation on fork of deleted project
requested to merge 732-error-500-when-attempting-to-create-mr-undefined-method-approvals_before_merge-for-nil-nilclass into master
The selected_target_project
helper method is used for actions where
target_project_id
is a top-level parameter, not nested under the
merge_request
hash.
Even though that logic was wrong, if the target project wasn't a fork,
or was a fork of an active project, this would work through
coincidence (although it might check the wrong value for
approvals_before_merge
).
If a project was a fork of a deleted project, however, then
selected_target_project
would be nil
, causing a 500 error. Ensure
that there is always a target project to compare to.
Closes #732 (closed).