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