Commit 607f0c05 authored by Douwe Maan's avatar Douwe Maan

Change EmailsOnPush subject to include namespace, repo and branch.

See #1827.
parent a30a5663
......@@ -23,21 +23,24 @@ module Emails
@commits = Commit.decorate(compare.commits)
@diffs = compare.diffs
@branch = branch
@subject = "[#{@project.path_with_namespace}][#{@branch}] "
if @commits.length > 1
@target_url = namespace_project_compare_url(@project.namespace,
@project,
from: @commits.first,
to: @commits.last)
@subject = "#{@commits.length} new commits pushed to repository"
@subject << "#{@commits.length} commits: #{@commits.first.title}"
else
@target_url = namespace_project_commit_url(@project.namespace,
@project, @commits.first)
@subject = @commits.first.title
@subject << @commits.first.title
end
mail(from: sender(author_id),
to: recipient,
subject: subject(@subject))
subject: @subject)
end
end
end
......@@ -583,7 +583,7 @@ describe Notify do
end
it 'has the correct subject' do
is_expected.to have_subject /#{commits.length} new commits pushed to repository/
is_expected.to have_subject /\[#{project.path_with_namespace}\]\[master\] #{commits.length} commits:/
end
it 'includes commits list' 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