Commit 45c03a09 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'ce-to-ee-2018-08-27' into 'master'

CE upstream - 2018-08-27 09:23 UTC

See merge request gitlab-org/gitlab-ee!6998
parents 368aed74 3fe53872
......@@ -129,8 +129,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?
......@@ -160,20 +159,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?
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?
title_parts.join(' ')
end
def issue_iid
......
......@@ -16,6 +16,9 @@
= milestone_date_range(milestone)
%div
= render('shared/milestone_expired', milestone: milestone)
- if milestone.group_milestone?
.label-badge.label-badge-blue.d-inline-block
= milestone.group.full_name
- if milestone.legacy_group_milestone?
.projects
- milestone.milestones.each do |milestone|
......
---
title: Add group name badge under group milestone
merge_request: 21384
author:
type: added
---
title: Fix fallback logic for automatic MR title assignment
merge_request: 20930
author: Franz Liedke
type: fixed
......@@ -13,8 +13,10 @@ describe 'Dashboard > Milestones' do
describe 'as logged-in user' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: user.namespace) }
let!(:milestone) { create(:milestone, project: project) }
let!(:milestone2) { create(:milestone, group: group) }
before do
project.add_maintainer(user)
sign_in(user)
......@@ -24,6 +26,7 @@ describe 'Dashboard > Milestones' do
it 'sees milestones' do
expect(current_path).to eq dashboard_milestones_path
expect(page).to have_content(milestone.title)
expect(page).to have_content(group.name)
end
end
end
......@@ -169,6 +169,10 @@ describe MergeRequests::BuildService do
end
end
it 'uses the title of the commit as the title of the merge request' do
expect(merge_request.title).to eq('Initial commit')
end
it 'appends the closing description' do
expected_description = [commit_description, closing_message].compact.join("\n\n")
......
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