diff options
author | Franz Liedke <franz@develophp.org> | 2018-08-02 20:33:49 +0300 |
---|---|---|
committer | Franz Liedke <franz@develophp.org> | 2018-08-26 00:02:36 +0300 |
commit | 72c0c5342c4b1a59742af16ba9cf874b465ccdbd (patch) | |
tree | 3fca175d2033b95566b42bd0888724a96a48ad63 /app/services | |
parent | 50f9e92651c1b82d8f8df960754f2736a606d6f8 (diff) |
REFACTOR: Use early return to flatten code
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/merge_requests/build_service.rb | 11 |
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 |