@@ -239,7 +239,7 @@ async function sendInterviewComingUpNotifications () {
239
239
if ( ! _ . isEmpty ( interview . hostEmail ) ) {
240
240
sendNotification ( { } , {
241
241
template : 'taas.notification.interview-coming-up-host' ,
242
- recipients : [ interview . hostEmail ] ,
242
+ recipients : [ { email : interview . hostEmail } ] ,
243
243
data : {
244
244
...data ,
245
245
notificationType : {
@@ -258,7 +258,7 @@ async function sendInterviewComingUpNotifications () {
258
258
// send guest emails
259
259
sendNotification ( { } , {
260
260
template : 'taas.notification.interview-coming-up-guest' ,
261
- recipients : interview . guestEmails ,
261
+ recipients : interview . guestEmails . map ( ( email ) => ( { email } ) ) ,
262
262
data : {
263
263
...data ,
264
264
notificationType : {
@@ -323,7 +323,7 @@ async function sendInterviewCompletedNotifications () {
323
323
324
324
sendNotification ( { } , {
325
325
template : 'taas.notification.interview-awaits-resolution' ,
326
- recipients : [ interview . hostEmail ] ,
326
+ recipients : [ { email : interview . hostEmail } ] ,
327
327
data : {
328
328
...data ,
329
329
notificationType : {
@@ -543,7 +543,7 @@ async function sendResourceBookingExpirationNotifications () {
543
543
async function sendNotification ( currentUser , data , webNotifications = [ ] ) {
544
544
const template = emailTemplates [ data . template ]
545
545
const dataCC = data . cc || [ ]
546
- const templateCC = template . cc || [ ]
546
+ const templateCC = ( template . cc || [ ] ) . map ( email => ( { email } ) )
547
547
const dataRecipients = data . recipients || [ ]
548
548
const templateRecipients = ( template . recipients || [ ] ) . map ( email => ( { email } ) )
549
549
const subjectBody = {
@@ -557,14 +557,14 @@ async function sendNotification (currentUser, data, webNotifications = []) {
557
557
)
558
558
}
559
559
560
- const recipients = _ . map ( _ . uniq ( [ ...dataRecipients , ...templateRecipients ] ) , function ( r ) { return { email : r } } )
560
+ const recipients = _ . uniq ( [ ...dataRecipients , ...templateRecipients ] )
561
561
const emailData = {
562
562
serviceId : 'email' ,
563
563
type : data . template ,
564
564
details : {
565
565
from : data . from || template . from ,
566
566
recipients,
567
- cc : _ . map ( _ . uniq ( [ ...dataCC , ...templateCC ] ) , function ( r ) { return { email : r } } ) ,
567
+ cc : _ . uniq ( [ ...dataCC , ...templateCC ] ) ,
568
568
data : { ...data . data , ...subjectBody } ,
569
569
sendgridTemplateId : template . sendgridTemplateId ,
570
570
version : 'v3'
0 commit comments