GitLab wurde erfolgreich aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Danke für Ihre Geduld.

Commit b35378a9 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '24333-close-issues-with-merge-request-title-ui' into 'master'

Show mentioned/issues being closed from a Merge Requests title

Closes #24333

See merge request !9194
parents 44406ae8 217937e5
......@@ -561,7 +561,7 @@ def cache_merge_request_closes_issues!(current_user)
# Return the set of issues that will be closed if this merge request is accepted.
def closes_issues(current_user = self.author)
if target_branch == project.default_branch
messages = [description]
messages = [title, description]
messages.concat(commits.map(&:safe_message)) if merge_request_diff
Gitlab::ClosingIssueExtractor.new(project, current_user).
......@@ -575,7 +575,7 @@ def issues_mentioned_but_not_closing(current_user)
return [] unless target_branch == project.default_branch
ext = Gitlab::ReferenceExtractor.new(project, current_user)
ext.analyze(description)
ext.analyze("#{title}\n#{description}")
ext.issues - closes_issues(current_user)
end
......
---
title: Show Issues mentioned / being closed from a Merge Requests title below the
'Accept Merge Request' button
merge_request: 9194
author: Jan Christophersen
......@@ -10,10 +10,12 @@
:merge_request,
:simple,
source_project: project,
description: merge_request_description
description: merge_request_description,
title: merge_request_title
)
end
let(:merge_request_description) { 'Merge Request Description' }
let(:merge_request_title) { 'Merge Request Title' }
before do
project.team << [user, :master]
......@@ -45,8 +47,32 @@
end
end
context 'closing some issues and mentioning, but not closing, others' do
let(:merge_request_description) { "Description\n\ncloses #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
context 'closing some issues in title and mentioning, but not closing, others' do
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
it 'does not display closing issue message' do
expect(page).to have_content("Accepting this merge request will close issue #{issue_1.to_reference}. Issue #{issue_2.to_reference} is mentioned but will not be closed.")
end
end
context 'closing issues using title but not mentioning any other issue' do
let(:merge_request_title) { "closing #{issue_1.to_reference}, #{issue_2.to_reference}" }
it 'does not display closing issue message' do
expect(page).to have_content("Accepting this merge request will close issues #{issue_1.to_reference} and #{issue_2.to_reference}")
end
end
context 'mentioning issues using title but not closing them' do
let(:merge_request_title) { "Refers to #{issue_1.to_reference} and #{issue_2.to_reference}" }
it 'does not display closing issue message' do
expect(page).to have_content("Issues #{issue_1.to_reference} and #{issue_2.to_reference} are mentioned but will not be closed.")
end
end
context 'closing some issues using title and mentioning, but not closing, others' do
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
it 'does not display closing issue message' do
expect(page).to have_content("Accepting this merge request will close issue #{issue_1.to_reference}. Issue #{issue_2.to_reference} is mentioned but will not be closed.")
......
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