Commit 09209725 authored by Sean McGivern's avatar Sean McGivern

Don't auto-set MR title for confidential issues

parent e76f339d
...@@ -68,7 +68,7 @@ module MergeRequests ...@@ -68,7 +68,7 @@ module MergeRequests
commit = commits.first commit = commits.first
merge_request.title = commit.title merge_request.title = commit.title
merge_request.description ||= commit.description.try(:strip) merge_request.description ||= commit.description.try(:strip)
elsif iid && (issue = merge_request.target_project.get_issue(iid)) elsif iid && (issue = merge_request.target_project.get_issue(iid)) && !issue.try(:confidential?)
case issue case issue
when Issue when Issue
merge_request.title = "Resolve \"#{issue.title}\"" merge_request.title = "Resolve \"#{issue.title}\""
......
...@@ -5,7 +5,8 @@ describe MergeRequests::BuildService, services: true do ...@@ -5,7 +5,8 @@ describe MergeRequests::BuildService, services: true do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:issue) { create(:issue, project: project, title: 'A bug') } let(:issue_confidential) { false }
let(:issue) { create(:issue, project: project, title: 'A bug', confidential: issue_confidential) }
let(:description) { nil } let(:description) { nil }
let(:source_branch) { 'feature-branch' } let(:source_branch) { 'feature-branch' }
let(:target_branch) { 'master' } let(:target_branch) { 'master' }
...@@ -156,6 +157,14 @@ describe MergeRequests::BuildService, services: true do ...@@ -156,6 +157,14 @@ describe MergeRequests::BuildService, services: true do
expect(merge_request.title).to eq("#{issue.iid.succ} fix issue") expect(merge_request.title).to eq("#{issue.iid.succ} fix issue")
end end
end end
context 'issue is confidential' do
let(:issue_confidential) { true }
it 'uses the title of the branch as the merge request title' do
expect(merge_request.title).to eq("#{issue.iid} fix issue")
end
end
end end
context 'branch starts with external issue IID followed by a hyphen' do context 'branch starts with external issue IID followed by a hyphen' 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