diff --git a/apps/web/components/booking/pages/BookingPage.tsx b/apps/web/components/booking/pages/BookingPage.tsx
index b1cca05ff5..bb27d4b03c 100644
--- a/apps/web/components/booking/pages/BookingPage.tsx
+++ b/apps/web/components/booking/pages/BookingPage.tsx
@@ -911,7 +911,7 @@ function ErrorMessage({ error }: { error: unknown }) {
{rescheduleUid ? t("reschedule_fail") : t("booking_fail")}{" "}
- {error instanceof HttpError || error instanceof Error ? error.message : "Unknown error"}
+ {error instanceof HttpError || error instanceof Error ? t(error.message) : "Unknown error"}
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index d64fb23169..99a8061ad3 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -1372,5 +1372,6 @@
"test_preview": "Test Preview",
"route_to": "Route to",
"test_preview_description": "Test your routing form without submitting any data",
- "test_routing": "Test Routing"
+ "test_routing": "Test Routing",
+ "booking_limit_reached":"Booking Limit for this event type has been reached"
}
diff --git a/packages/core/getBusyTimes.ts b/packages/core/getBusyTimes.ts
index 8baa2d6a64..e000a983b6 100644
--- a/packages/core/getBusyTimes.ts
+++ b/packages/core/getBusyTimes.ts
@@ -52,6 +52,7 @@ export async function getBusyTimes(params: {
title: true,
eventType: {
select: {
+ id: true,
afterEventBuffer: true,
beforeEventBuffer: true,
},
@@ -67,7 +68,7 @@ export async function getBusyTimes(params: {
.add((eventType?.afterEventBuffer || 0) + (beforeEventBuffer || 0), "minute")
.toDate(),
title,
- source: `eventType-${eventTypeId}-booking-${id}`,
+ source: `eventType-${eventType?.id}-booking-${id}`,
}))
);
logger.silly(`Busy Time from Cal Bookings ${JSON.stringify(busyTimes)}`);
diff --git a/packages/core/getUserAvailability.ts b/packages/core/getUserAvailability.ts
index bfeeb0171f..0ddddeb227 100644
--- a/packages/core/getUserAvailability.ts
+++ b/packages/core/getUserAvailability.ts
@@ -202,10 +202,13 @@ export async function getUserAvailability(
const startDate = dayjs(booking.start).startOf(filter);
// this is parsed above with parseBookingLimit so we know it's safe.
const endDate = dayjs(startDate).endOf(filter);
-
+ const bookingEventTypeId = booking.source?.split("-")[1];
if (dayjs(booking.start).isBetween(startDate, endDate)) total++;
- if (total >= limit)
+ // Only check OUR booking that matches the current eventTypeId
+ // we don't care about another event type in this case as we dont need to know their booking limits
+ if (total >= limit && bookingEventTypeId === eventType?.id?.toString()) {
bufferedBusyTimes.push({ start: startDate.toISOString(), end: endDate.toISOString() });
+ }
});
}
}
diff --git a/packages/lib/server/checkBookingLimits.ts b/packages/lib/server/checkBookingLimits.ts
index c18b431ae7..7d81c1dd10 100644
--- a/packages/lib/server/checkBookingLimits.ts
+++ b/packages/lib/server/checkBookingLimits.ts
@@ -86,7 +86,7 @@ export async function checkLimit({
}
throw new HttpError({
- message: `Booking limit of ${limitingNumber}/${filter} reached for this eventType`,
+ message: `booking_limit_reached`,
statusCode: 403,
});
}