summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranz Liedke <franz@develophp.org>2018-08-02 19:33:49 +0200
committerFranz Liedke <franz@develophp.org>2018-08-25 23:02:36 +0200
commit72c0c5342c4b1a59742af16ba9cf874b465ccdbd (patch)
tree3fca175d2033b95566b42bd0888724a96a48ad63
parent50f9e92651c1b82d8f8df960754f2736a606d6f8 (diff)
downloadgitlab-ce-72c0c5342c4b1a59742af16ba9cf874b465ccdbd.tar.gz
REFACTOR: Use early return to flatten code
-rw-r--r--app/services/merge_requests/build_service.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb
index 414922b5753..af44bd1d966 100644
--- a/app/services/merge_requests/build_service.rb
+++ b/app/services/merge_requests/build_service.rb
@@ -165,14 +165,13 @@ module MergeRequests
merge_request.title ||= "Resolve \"#{issue.title}\"" if issue.is_a?(Issue)
return if merge_request.title.present?
+ return if issue_iid.blank?
- if issue_iid.present?
- title_parts = ["Resolve #{issue.to_reference}"]
- branch_title = source_branch.downcase.remove(issue_iid.downcase).titleize.humanize
+ title_parts = ["Resolve #{issue.to_reference}"]
+ branch_title = source_branch.downcase.remove(issue_iid.downcase).titleize.humanize
- title_parts << "\"#{branch_title}\"" if branch_title.present?
- merge_request.title = title_parts.join(' ')
- end
+ title_parts << "\"#{branch_title}\"" if branch_title.present?
+ merge_request.title = title_parts.join(' ')
end
def issue_iid