diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-10-18 20:02:35 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-10-18 20:02:35 +0800 |
commit | 045c6715330d25adff95304a3de908037c63a163 (patch) | |
tree | 23ed554dd0eed9a2088c1ecf49dd096b77f8a368 /app/mailers | |
parent | 12ef494db812de3790ad5f42152f9b3fdf8c9f3c (diff) | |
download | gitlab-ce-045c6715330d25adff95304a3de908037c63a163.tar.gz |
Use bcc for pipeline emails because:
We use bcc here because we don't want to generate this emails for a
thousand times. This could be potentially expensive in a loop, and
recipients would contain all project watchers so it could be a lot.
Diffstat (limited to 'app/mailers')
-rw-r--r-- | app/mailers/emails/pipelines.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/app/mailers/emails/pipelines.rb b/app/mailers/emails/pipelines.rb index 601c8b5cd62..9460a6cd2be 100644 --- a/app/mailers/emails/pipelines.rb +++ b/app/mailers/emails/pipelines.rb @@ -1,22 +1,27 @@ module Emails module Pipelines - def pipeline_success_email(pipeline, to) - pipeline_mail(pipeline, to, 'succeeded') + def pipeline_success_email(pipeline, recipients) + pipeline_mail(pipeline, recipients, 'succeeded') end - def pipeline_failed_email(pipeline, to) - pipeline_mail(pipeline, to, 'failed') + def pipeline_failed_email(pipeline, recipients) + pipeline_mail(pipeline, recipients, 'failed') end private - def pipeline_mail(pipeline, to, status) + def pipeline_mail(pipeline, recipients, status) @project = pipeline.project @pipeline = pipeline @merge_request = pipeline.merge_requests.first add_headers - mail(to: to, subject: pipeline_subject(status), skip_premailer: true) do |format| + # We use bcc here because we don't want to generate this emails for a + # thousand times. This could be potentially expensive in a loop, and + # recipients would contain all project watchers so it could be a lot. + mail(bcc: recipients, + subject: pipeline_subject(status), + skip_premailer: true) do |format| format.html { render layout: false } format.text end |