Skip to content

Commit 058d6d0

Browse files
committed
fix recipients for project member notifications
1 parent 36e202e commit 058d6d0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/services/NotificationsSchedulerService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async function sendInterviewComingUpNotifications () {
239239
if (!_.isEmpty(interview.hostEmail)) {
240240
sendNotification({}, {
241241
template: 'taas.notification.interview-coming-up-host',
242-
recipients: [interview.hostEmail],
242+
recipients: [{ email: interview.hostEmail }],
243243
data: {
244244
...data,
245245
notificationType: {
@@ -258,7 +258,7 @@ async function sendInterviewComingUpNotifications () {
258258
// send guest emails
259259
sendNotification({}, {
260260
template: 'taas.notification.interview-coming-up-guest',
261-
recipients: interview.guestEmails,
261+
recipients: interview.guestEmails.map((email) => ({ email })),
262262
data: {
263263
...data,
264264
notificationType: {
@@ -323,7 +323,7 @@ async function sendInterviewCompletedNotifications () {
323323

324324
sendNotification({}, {
325325
template: 'taas.notification.interview-awaits-resolution',
326-
recipients: [interview.hostEmail],
326+
recipients: [{ email: interview.hostEmail }],
327327
data: {
328328
...data,
329329
notificationType: {
@@ -543,7 +543,7 @@ async function sendResourceBookingExpirationNotifications () {
543543
async function sendNotification (currentUser, data, webNotifications = []) {
544544
const template = emailTemplates[data.template]
545545
const dataCC = data.cc || []
546-
const templateCC = template.cc || []
546+
const templateCC = (template.cc || []).map(email => ({ email }))
547547
const dataRecipients = data.recipients || []
548548
const templateRecipients = (template.recipients || []).map(email => ({ email }))
549549
const subjectBody = {
@@ -557,14 +557,14 @@ async function sendNotification (currentUser, data, webNotifications = []) {
557557
)
558558
}
559559

560-
const recipients = _.map(_.uniq([...dataRecipients, ...templateRecipients]), function (r) { return { email: r } })
560+
const recipients = _.uniq([...dataRecipients, ...templateRecipients])
561561
const emailData = {
562562
serviceId: 'email',
563563
type: data.template,
564564
details: {
565565
from: data.from || template.from,
566566
recipients,
567-
cc: _.map(_.uniq([...dataCC, ...templateCC]), function (r) { return { email: r } }),
567+
cc: _.uniq([...dataCC, ...templateCC]),
568568
data: { ...data.data, ...subjectBody },
569569
sendgridTemplateId: template.sendgridTemplateId,
570570
version: 'v3'

0 commit comments

Comments
 (0)