Commit 72c0c534 authored by Franz Liedke's avatar Franz Liedke

REFACTOR: Use early return to flatten code

parent 50f9e926
...@@ -165,14 +165,13 @@ module MergeRequests ...@@ -165,14 +165,13 @@ module MergeRequests
merge_request.title ||= "Resolve \"#{issue.title}\"" if issue.is_a?(Issue) merge_request.title ||= "Resolve \"#{issue.title}\"" if issue.is_a?(Issue)
return if merge_request.title.present? return if merge_request.title.present?
return if issue_iid.blank?
if issue_iid.present? title_parts = ["Resolve #{issue.to_reference}"]
title_parts = ["Resolve #{issue.to_reference}"] branch_title = source_branch.downcase.remove(issue_iid.downcase).titleize.humanize
branch_title = source_branch.downcase.remove(issue_iid.downcase).titleize.humanize
title_parts << "\"#{branch_title}\"" if branch_title.present? title_parts << "\"#{branch_title}\"" if branch_title.present?
merge_request.title = title_parts.join(' ') merge_request.title = title_parts.join(' ')
end
end end
def issue_iid def issue_iid
......
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