BigW Consortium Gitlab

Commit 603ef5d4 by Gabriel Gizotti

Show either description or closes issues references on…

Show either description or closes issues references on MergeRequest#merge_commit_message so closes issues references are not duplicated
parent 99dd58ec
......@@ -633,18 +633,20 @@ class MergeRequest < ActiveRecord::Base
issue.to_reference(target_project)
end
message = "Merge branch '#{source_branch}' into '#{target_branch}'\n\n"
message << "#{title}\n\n"
message = [
"Merge branch '#{source_branch}' into '#{target_branch}'",
title
]
if closes_issues_references.present?
if !include_description && closes_issues_references.present?
issue_text = 'issue'.pluralize(closes_issues_references.size)
message << "Closes #{issue_text} #{closes_issues_references.to_sentence}\n\n"
message << "Closes #{issue_text} #{closes_issues_references.to_sentence}"
end
message << "#{description}\n\n" if include_description && description.present?
message << "#{description}" if include_description && description.present?
message << "See merge request #{to_reference}"
message
message.join("\n\n")
end
def reset_merge_when_build_succeeds
......
......@@ -30,7 +30,7 @@
- elsif @merge_request.can_be_merged? || resolved_conflicts
= render 'projects/merge_requests/widget/open/accept'
- if mr_closes_issues.present? || mr_issues_mentioned_but_not_closing
- if mr_closes_issues.present? || mr_issues_mentioned_but_not_closing.present?
.mr-widget-footer
%span
= icon('check')
......@@ -41,9 +41,7 @@
= mr_assign_issues_link
- if mr_issues_mentioned_but_not_closing.present?
#{"Issue".pluralize(mr_issues_mentioned_but_not_closing.size)}
= succeed '' do
!= markdown issues_sentence(mr_issues_mentioned_but_not_closing), pipeline: :gfm, author: @merge_request.author
= succeed '' do
mentioned but will not closed.
!= markdown issues_sentence(mr_issues_mentioned_but_not_closing), pipeline: :gfm, author: @merge_request.author
#{mr_issues_mentioned_but_not_closing.size > 1 ? 'are' : 'is'} mentioned but will not closed.
......@@ -425,7 +425,7 @@ describe MergeRequest, models: true do
and_return(subject.target_branch)
expect(subject.merge_commit_message)
.to match("Closed Issues: #{issue.to_reference}")
.to match("Closes issue #{issue.to_reference}")
end
it 'includes its reference in the body' do
......
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