@@ -44,12 +44,12 @@ async function getProjectWithId (projectId) {
44
44
45
45
/**
46
46
* extract the members of projects and build recipients list out of them
47
- * we can use `userId ` to identify recipients
47
+ * we can use `email ` to identify recipients
48
48
* @param project the project
49
49
* @returns {string[] } array of recipients
50
50
*/
51
51
function buildProjectTeamRecipients ( project ) {
52
- const recipients = _ . unionBy ( _ . map ( project . members , m => _ . pick ( m , 'userId ' ) ) , 'userId ' )
52
+ const recipients = _ . unionBy ( _ . map ( project . members , m => _ . pick ( m , 'email ' ) ) , 'email ' )
53
53
if ( _ . isEmpty ( recipients ) ) {
54
54
localLogger . error ( `No recipients for projectId:${ project . id } ` , 'buildProjectTeamRecipients' )
55
55
}
@@ -276,11 +276,11 @@ async function sendInterviewComingUpNotifications () {
276
276
const data = await getDataForInterview ( interview )
277
277
if ( ! data ) { continue }
278
278
279
- if ( ! _ . isEmpty ( interview . hostEmail ) ) {
279
+ if ( ! _ . isEmpty ( data . hostEmail ) ) {
280
280
data . startTime = formatInterviewTime ( interview , { forInterviewHost : true } )
281
281
sendNotification ( { } , {
282
282
template : 'taas.notification.interview-coming-up-host' ,
283
- recipients : [ { email : interview . hostEmail } ] ,
283
+ recipients : [ { email : data . hostEmail } ] ,
284
284
data
285
285
} )
286
286
@@ -289,12 +289,12 @@ async function sendInterviewComingUpNotifications () {
289
289
localLogger . error ( `Interview id: ${ interview . id } host email not present` , 'sendInterviewComingUpNotifications' )
290
290
}
291
291
292
- if ( ! _ . isEmpty ( interview . guestEmails ) ) {
292
+ if ( ! _ . isEmpty ( data . guestEmail ) ) {
293
293
data . startTime = formatInterviewTime ( interview , { forInterviewGuest : true } )
294
294
// send guest emails
295
295
sendNotification ( { } , {
296
296
template : 'taas.notification.interview-coming-up-guest' ,
297
- recipients : interview . guestEmails . map ( ( email ) => ( { email } ) ) ,
297
+ recipients : [ { email : data . guestEmail } ] ,
298
298
data
299
299
} )
300
300
@@ -354,22 +354,23 @@ async function sendInterviewCompletedNotifications () {
354
354
355
355
let sentCount = 0
356
356
for ( const interview of interviews ) {
357
- if ( _ . isEmpty ( interview . hostEmail ) ) {
358
- localLogger . error ( `Interview id: ${ interview . id } host email not present` )
359
- continue
360
- }
361
357
if ( ! jcMap [ interview . jobCandidateId ] || jcMap [ interview . jobCandidateId ] . status !== constants . JobCandidateStatus . INTERVIEW ) {
362
358
localLogger . error ( `Interview id: ${ interview . id } job candidate status is not ${ constants . JobCandidateStatus . INTERVIEW } ` )
363
359
continue
364
360
}
365
361
366
362
const data = await getDataForInterview ( interview , jcMap [ interview . jobCandidateId ] )
363
+
364
+ if ( _ . isEmpty ( data . hostEmail ) ) {
365
+ localLogger . error ( `Interview id: ${ interview . id } host email not present` )
366
+ continue
367
+ }
367
368
if ( ! data ) { continue }
368
369
data . startTime = formatInterviewTime ( interview , { forInterviewHost : true } )
369
370
370
371
sendNotification ( { } , {
371
372
template : 'taas.notification.interview-awaits-resolution' ,
372
- recipients : [ { email : interview . hostEmail } ] ,
373
+ recipients : [ { email : data . hostEmail } ] ,
373
374
data
374
375
} )
375
376
0 commit comments