fix: use correct organizer info when admin accepts team booking requiring confirmation (#20612)

* fix: confrim handler

* fix test
This commit is contained in:
Anik Dhabal Babu
2025-04-09 10:45:27 +05:30
committed by GitHub
parent b9b12256fa
commit 3d02df3b08
2 changed files with 23 additions and 12 deletions
+1 -1
View File
@@ -191,7 +191,7 @@ test.describe("BOOKING_REJECTED", async () => {
endTime: "[redacted/dynamic]",
organizer: {
id: "[redacted/dynamic]",
name: "Unnamed",
name: "Nameless",
email: "[redacted/dynamic]",
timeZone: "[redacted/dynamic]",
language: "[redacted/dynamic]",
@@ -51,8 +51,6 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
platformClientParams,
} = input;
const tOrganizer = await getTranslation(user.locale ?? "en", "common");
const booking = await prisma.booking.findUniqueOrThrow({
where: {
id: bookingId,
@@ -110,6 +108,18 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
},
location: true,
userId: true,
user: {
select: {
id: true,
username: true,
email: true,
timeZone: true,
timeFormat: true,
name: true,
destinationCalendar: true,
locale: true,
},
},
id: true,
uid: true,
payment: true,
@@ -183,6 +193,7 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
);
const attendeesList = await Promise.all(attendeesListPromises);
const tOrganizer = await getTranslation(booking.user?.locale ?? "en", "common");
const evt: CalendarEvent = {
type: booking?.eventType?.slug as string,
@@ -198,20 +209,20 @@ export const confirmHandler = async ({ ctx, input }: ConfirmOptions) => {
startTime: booking.startTime.toISOString(),
endTime: booking.endTime.toISOString(),
organizer: {
email: booking.userPrimaryEmail ?? user.email,
name: user.name || "Unnamed",
username: user.username || undefined,
timeZone: user.timeZone,
timeFormat: getTimeFormatStringFromUserTimeFormat(user.timeFormat),
language: { translate: tOrganizer, locale: user.locale ?? "en" },
email: booking?.userPrimaryEmail || booking.user?.email || "Email-less",
name: booking.user?.name || "Nameless",
username: booking.user?.username || undefined,
timeZone: booking.user?.timeZone || "Europe/London",
timeFormat: getTimeFormatStringFromUserTimeFormat(booking.user?.timeFormat),
language: { translate: tOrganizer, locale: booking.user?.locale ?? "en" },
},
attendees: attendeesList,
location: booking.location ?? "",
uid: booking.uid,
destinationCalendar: booking?.destinationCalendar
destinationCalendar: booking.destinationCalendar
? [booking.destinationCalendar]
: user.destinationCalendar
? [user.destinationCalendar]
: booking.user?.destinationCalendar
? [booking.user?.destinationCalendar]
: [],
requiresConfirmation: booking?.eventType?.requiresConfirmation ?? false,
eventTypeId: booking.eventType?.id,