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