Fix showing seat attendees in emails (#8033)
* Pass seats info to location change * Fix cloning emails * Add cloning of event in AttendeeScheduledEmail class
This commit is contained in:
parent
762810684e
commit
ae5425f908
|
@ -16,20 +16,18 @@ export default class AttendeeScheduledEmail extends BaseEmail {
|
|||
attendee: Person;
|
||||
showAttendees: boolean | undefined;
|
||||
t: TFunction;
|
||||
attendees: Person[];
|
||||
|
||||
constructor(calEvent: CalendarEvent, attendee: Person, showAttendees?: boolean | undefined) {
|
||||
super();
|
||||
this.name = "SEND_BOOKING_CONFIRMATION";
|
||||
this.calEvent = calEvent;
|
||||
this.attendee = attendee;
|
||||
this.showAttendees = showAttendees;
|
||||
this.t = attendee.language.translate;
|
||||
this.attendees = [...this.calEvent.attendees];
|
||||
if (!this.showAttendees && this.calEvent.seatsPerTimeSlot) {
|
||||
this.attendees = [this.attendee];
|
||||
this.calEvent.attendees = [this.attendee];
|
||||
if (!showAttendees && calEvent.seatsPerTimeSlot) {
|
||||
this.calEvent = cloneDeep(calEvent);
|
||||
this.calEvent.attendees = [attendee];
|
||||
} else {
|
||||
this.calEvent = calEvent;
|
||||
}
|
||||
this.name = "SEND_BOOKING_CONFIRMATION";
|
||||
this.attendee = attendee;
|
||||
this.t = attendee.language.translate;
|
||||
}
|
||||
|
||||
protected getiCalEventAsString(): string | undefined {
|
||||
|
|
|
@ -67,6 +67,7 @@ async function getBookingToDelete(id: number | undefined, uid: string | undefine
|
|||
currency: true,
|
||||
length: true,
|
||||
seatsPerTimeSlot: true,
|
||||
seatsShowAttendees: true,
|
||||
hosts: {
|
||||
select: {
|
||||
user: true,
|
||||
|
@ -190,6 +191,8 @@ async function handler(req: CustomRequest) {
|
|||
destinationCalendar: bookingToDelete?.destinationCalendar || bookingToDelete?.user.destinationCalendar,
|
||||
cancellationReason: cancellationReason,
|
||||
...(teamMembers && { team: { name: "", members: teamMembers } }),
|
||||
seatsPerTimeSlot: bookingToDelete.eventType?.seatsPerTimeSlot,
|
||||
seatsShowAttendees: bookingToDelete.eventType?.seatsShowAttendees,
|
||||
};
|
||||
|
||||
// If it's just an attendee of a booking then just remove them from that booking
|
||||
|
|
|
@ -1010,6 +1010,16 @@ async function handler(
|
|||
throw new HttpError({ statusCode: 401 });
|
||||
}
|
||||
|
||||
// Moving forward in this block is the owner making changes to the booking. All attendees should be affected
|
||||
evt.attendees = originalRescheduledBooking.attendees.map((attendee) => {
|
||||
return {
|
||||
name: attendee.name,
|
||||
email: attendee.email,
|
||||
timeZone: attendee.timeZone,
|
||||
language: { translate: tAttendees, locale: attendee.locale ?? "en" },
|
||||
};
|
||||
});
|
||||
|
||||
// If owner reschedules the event we want to update the entire booking
|
||||
// Also if owner is rescheduling there should be no bookingSeat
|
||||
|
||||
|
|
|
@ -1032,6 +1032,8 @@ const loggedInViewerRouter = router({
|
|||
select: {
|
||||
recurringEvent: true,
|
||||
title: true,
|
||||
seatsPerTimeSlot: true,
|
||||
seatsShowAttendees: true,
|
||||
},
|
||||
},
|
||||
uid: true,
|
||||
|
@ -1110,6 +1112,8 @@ const loggedInViewerRouter = router({
|
|||
location: booking.location,
|
||||
destinationCalendar: booking.destinationCalendar || booking.user?.destinationCalendar,
|
||||
cancellationReason: "Payment method removed by organizer",
|
||||
seatsPerTimeSlot: booking.eventType?.seatsPerTimeSlot,
|
||||
seatsShowAttendees: booking.eventType?.seatsShowAttendees,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -672,6 +672,8 @@ export const bookingsRouter = router({
|
|||
recurringEvent: parseRecurringEvent(booking.eventType?.recurringEvent),
|
||||
location,
|
||||
destinationCalendar: booking?.destinationCalendar || booking?.user?.destinationCalendar,
|
||||
seatsPerTimeSlot: booking.eventType?.seatsPerTimeSlot,
|
||||
seatsShowAttendees: booking.eventType?.seatsShowAttendees,
|
||||
};
|
||||
|
||||
const eventManager = new EventManager(ctx.user);
|
||||
|
|
Loading…
Reference in New Issue
Block a user