Commit f31f101d364ea51bb32a7ed0c8a66ccff7811a15

Authored by Sytse Sijbrandij
2 parents 46e33ed3 e6722cb1

Merge pull request #6831 from pkill/better-email-on-push-subject

Provide better email subject lines from email on push service
CHANGELOG
... ... @@ -37,6 +37,7 @@ v 7.0.0
37 37 - Remove wall feature (no data loss - you can take it from database)
38 38 - Dont expose user emails via API unless you are admin
39 39 - Detect issues closed by Merge Request description
  40 + - Better email subject lines from email on push service (Alex Elman)
40 41  
41 42 v 6.9.2
42 43 - Revert the commit that broke the LDAP user filter
... ...
app/mailers/emails/projects.rb
... ... @@ -25,13 +25,15 @@ module Emails
25 25 @branch = branch
26 26 if @commits.length > 1
27 27 @target_url = project_compare_url(@project, from: @commits.first, to: @commits.last)
  28 + @subject = "#{@commits.length} new commits pushed to repository"
28 29 else
29 30 @target_url = project_commit_url(@project, @commits.first)
  31 + @subject = @commits.first.title
30 32 end
31 33  
32 34 mail(from: sender(author_id),
33 35 cc: recipient,
34   - subject: subject("New push to repository"))
  36 + subject: subject(@subject))
35 37 end
36 38 end
37 39 end
... ...
spec/mailers/notify_spec.rb
... ... @@ -537,7 +537,7 @@ describe Notify do
537 537 end
538 538  
539 539 it 'has the correct subject' do
540   - should have_subject /New push to repository/
  540 + should have_subject /#{commits.length} new commits pushed to repository/
541 541 end
542 542  
543 543 it 'includes commits list' do
... ... @@ -573,7 +573,7 @@ describe Notify do
573 573 end
574 574  
575 575 it 'has the correct subject' do
576   - should have_subject /New push to repository/
  576 + should have_subject /#{commits.first.title}/
577 577 end
578 578  
579 579 it 'includes commits list' do
... ...