mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 19:41:33 +02:00
[web] support email sender customization for email notifications (#33035)
GitOrigin-RevId: 9aa298c233c1f314ef3bdb381c20692bd0d4e212
This commit is contained in:
@@ -97,7 +97,7 @@ async function sendEmail(options, emailType) {
|
||||
metrics.inc('email')
|
||||
const sendMailOptions = {
|
||||
to: options.to,
|
||||
from: EMAIL_SETTINGS.fromAddress || '',
|
||||
from: options.from || EMAIL_SETTINGS.fromAddress || '',
|
||||
subject: options.subject,
|
||||
html: options.html,
|
||||
text: options.text,
|
||||
|
||||
@@ -99,6 +99,14 @@ describe('EmailSender', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('should use opts.from as override for settings fromAddress when provided', async function (ctx) {
|
||||
ctx.opts.from = 'no-reply@example.com'
|
||||
await ctx.EmailSender.promises.sendEmail(ctx.opts)
|
||||
expect(ctx.sesClient.sendMail).to.have.been.calledWithMatch({
|
||||
from: 'no-reply@example.com',
|
||||
})
|
||||
})
|
||||
|
||||
it('should not send an email when the rate limiter says no', async function (ctx) {
|
||||
ctx.opts.sendingUser_id = '12321312321'
|
||||
ctx.rateLimiter.consume.rejects({ remainingPoints: 0 })
|
||||
|
||||
Reference in New Issue
Block a user