Change EmailsOnPush subject to include namespace, repo and branch.

See #1827.
This commit is contained in:
Douwe Maan 2015-02-20 17:43:28 +01:00
parent a30a56634d
commit 607f0c05fe
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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