Merge pull request #10485 from colinux/fix-groupe-inst-mailer
Tech: fix l'envoi d'emails d'ajout à un groupe instructeurs
This commit is contained in:
commit
a15604b057
2 changed files with 10 additions and 2 deletions
|
@ -45,6 +45,7 @@ class BalancerDeliveryMethod
|
|||
|
||||
def prevent_delivery?(mail)
|
||||
return false if mail[BYPASS_UNVERIFIED_MAIL_PROTECTION].present?
|
||||
return false if mail.to.blank? # bcc list
|
||||
|
||||
user = User.find_by(email: mail.to.first)
|
||||
return user.unverified_email? if user.present?
|
||||
|
|
|
@ -2,8 +2,8 @@ RSpec.describe BalancerDeliveryMethod do
|
|||
class ExampleMailer < ApplicationMailer
|
||||
include BalancedDeliveryConcern
|
||||
|
||||
def greet(name, bypass_unverified_mail_protection: true)
|
||||
mail(to: name, from: "smtp_from", body: "Hello #{name}")
|
||||
def greet(name, bypass_unverified_mail_protection: true, **mail_args)
|
||||
mail(to: name, from: "smtp_from", body: "Hello #{name}", **mail_args)
|
||||
|
||||
bypass_unverified_mail_protection! if bypass_unverified_mail_protection
|
||||
end
|
||||
|
@ -202,6 +202,13 @@ RSpec.describe BalancerDeliveryMethod do
|
|||
it { expect(mail).to have_been_delivered_using(MockSmtp) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are only bcc recipients' do
|
||||
let(:bypass_unverified_mail_protection) { false }
|
||||
let(:mail) { ExampleMailer.greet(nil, bypass_unverified_mail_protection: false, bcc: ["'u@a.com'"]) }
|
||||
|
||||
it { expect(mail).to have_been_delivered_using(MockSmtp) }
|
||||
end
|
||||
end
|
||||
|
||||
# Helpers
|
||||
|
|
Loading…
Reference in a new issue