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