diff options
author | Franz Liedke <franz@develophp.org> | 2018-08-02 20:36:43 +0300 |
---|---|---|
committer | Franz Liedke <franz@develophp.org> | 2018-08-26 00:02:36 +0300 |
commit | 007163501c72fc05c448581e4e20098e4d6409aa (patch) | |
tree | 194e7bd878745b77bb6baf3c7138c8bbdd0449e3 /app/services | |
parent | 72c0c5342c4b1a59742af16ba9cf874b465ccdbd (diff) |
REFACTOR: Clarify assignment fallback chain
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/merge_requests/build_service.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index af44bd1d966..55750269bb4 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -128,8 +128,7 @@ module MergeRequests # def assign_title_and_description assign_title_and_description_from_single_commit - assign_title_from_issue if target_project.issues_enabled? || target_project.external_issue_tracker - + merge_request.title ||= title_from_issue if target_project.issues_enabled? || target_project.external_issue_tracker merge_request.title ||= source_branch.titleize.humanize merge_request.title = wip_title if compare_commits.empty? @@ -159,19 +158,18 @@ module MergeRequests merge_request.description ||= commit.description.try(:strip) end - def assign_title_from_issue + def title_from_issue return unless issue - merge_request.title ||= "Resolve \"#{issue.title}\"" if issue.is_a?(Issue) + return "Resolve \"#{issue.title}\"" if issue.is_a?(Issue) - return if merge_request.title.present? return if issue_iid.blank? 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(' ') + title_parts.join(' ') end def issue_iid |