fixes after merge
parent
88ab985ac4
commit
22a009edd2
|
@ -439,10 +439,18 @@ const createEvent = async (credential, calEvent: CalendarEvent): Promise<any> =>
|
|||
|
||||
const organizerMail = new EventOrganizerMail(calEvent, uid);
|
||||
const attendeeMail = new EventAttendeeMail(calEvent, uid);
|
||||
try {
|
||||
await organizerMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("organizerMail.sendEmail failed", e)
|
||||
}
|
||||
|
||||
if (!creationResult || !creationResult.disableConfirmationEmail) {
|
||||
try {
|
||||
await attendeeMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("attendeeMail.sendEmail failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -458,10 +466,18 @@ const updateEvent = async (credential, uidToUpdate: String, calEvent: CalendarEv
|
|||
|
||||
const organizerMail = new EventOrganizerRescheduledMail(calEvent, newUid);
|
||||
const attendeeMail = new EventAttendeeRescheduledMail(calEvent, newUid);
|
||||
try {
|
||||
await organizerMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("organizerMail.sendEmail failed", e)
|
||||
}
|
||||
|
||||
if (!updateResult || !updateResult.disableConfirmationEmail) {
|
||||
try {
|
||||
await attendeeMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("attendeeMail.sendEmail failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -193,10 +193,18 @@ const createMeeting = async (credential, calEvent: CalendarEvent): Promise<any>
|
|||
|
||||
const organizerMail = new VideoEventOrganizerMail(calEvent, uid, videoCallData);
|
||||
const attendeeMail = new VideoEventAttendeeMail(calEvent, uid, videoCallData);
|
||||
try {
|
||||
await organizerMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("organizerMail.sendEmail failed", e)
|
||||
}
|
||||
|
||||
if (!creationResult || !creationResult.disableConfirmationEmail) {
|
||||
try {
|
||||
await attendeeMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("attendeeMail.sendEmail failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -216,10 +224,18 @@ const updateMeeting = async (credential, uidToUpdate: String, calEvent: Calendar
|
|||
|
||||
const organizerMail = new EventOrganizerRescheduledMail(calEvent, newUid);
|
||||
const attendeeMail = new EventAttendeeRescheduledMail(calEvent, newUid);
|
||||
try {
|
||||
await organizerMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("organizerMail.sendEmail failed", e)
|
||||
}
|
||||
|
||||
if (!updateResult || !updateResult.disableConfirmationEmail) {
|
||||
try {
|
||||
await attendeeMail.sendEmail();
|
||||
} catch (e) {
|
||||
console.error("attendeeMail.sendEmail failed", e)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -93,7 +93,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
return updateEvent(credential, bookingRefUid, evt)
|
||||
.then(response => ({type: credential.type, success: true, response}))
|
||||
.catch(e => {
|
||||
console.error("createEvent failed", e)
|
||||
console.error("updateEvent failed", e)
|
||||
return {type: credential.type, success: false}
|
||||
});
|
||||
}));
|
||||
|
@ -103,12 +103,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
return updateMeeting(credential, bookingRefUid, evt)
|
||||
.then(response => ({type: credential.type, success: true, response}))
|
||||
.catch(e => {
|
||||
console.error("createEvent failed", e)
|
||||
console.error("updateMeeting failed", e)
|
||||
return {type: credential.type, success: false}
|
||||
});
|
||||
}));
|
||||
|
||||
if (results.every(res => !res.success)) {
|
||||
if (results.length > 0 && results.every(res => !res.success)) {
|
||||
res.status(500).json({message: "Rescheduling failed"});
|
||||
return;
|
||||
}
|
||||
|
@ -153,12 +153,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
return createMeeting(credential, evt)
|
||||
.then(response => ({type: credential.type, success: true, response}))
|
||||
.catch(e => {
|
||||
console.error("createEvent failed", e)
|
||||
console.error("createMeeting failed", e)
|
||||
return {type: credential.type, success: false}
|
||||
});
|
||||
}));
|
||||
|
||||
if (results.every(res => !res.success)) {
|
||||
if (results.length > 0 && results.every(res => !res.success)) {
|
||||
res.status(500).json({message: "Booking failed"});
|
||||
return;
|
||||
}
|
||||
|
@ -172,17 +172,19 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
}
|
||||
|
||||
const hashUID = results.length > 0 ? results[0].response.uid : translator.fromUUID(uuidv5(JSON.stringify(evt), uuidv5.URL));
|
||||
try {
|
||||
// TODO Should just be set to the true case as soon as we have a "bare email" integration class.
|
||||
// UID generation should happen in the integration itself, not here.
|
||||
if(results.length === 0) {
|
||||
// Legacy as well, as soon as we have a separate email integration class. Just used
|
||||
// to send an email even if there is no integration at all.
|
||||
try {
|
||||
const mail = new EventAttendeeMail(evt, hashUID);
|
||||
await mail.sendEmail();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("send EventAttendeeMail failed", e)
|
||||
console.error("Sending legacy event mail failed", e)
|
||||
res.status(500).json({message: "Booking failed"});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let booking;
|
||||
|
|
Loading…
Reference in New Issue