diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index 1baf6e8f33..736ed28ce8 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -132,6 +132,7 @@ function BookingListItem(booking: BookingItemProps) { }); const isUpcoming = new Date(booking.endTime) >= new Date(); + const isOngoing = isUpcoming && new Date() >= new Date(booking.startTime); const isBookingInPast = new Date(booking.endTime) < new Date(); const isCancelled = booking.status === BookingStatus.CANCELLED; const isConfirmed = booking.status === BookingStatus.ACCEPTED; @@ -269,7 +270,7 @@ function BookingListItem(booking: BookingItemProps) { }); } - if (isBookingInPast) { + if (isBookingInPast || isOngoing) { editBookingActions.push({ id: "no_show", label: t("mark_as_no_show"), diff --git a/packages/features/handleMarkNoShow.ts b/packages/features/handleMarkNoShow.ts index 784d3a70be..d2269ff83c 100644 --- a/packages/features/handleMarkNoShow.ts +++ b/packages/features/handleMarkNoShow.ts @@ -216,6 +216,16 @@ const assertCanAccessBooking = async (bookingUid: string, userId?: number) => { if (!booking) throw new HttpError({ statusCode: 403, message: "You are not allowed to access this booking" }); + + const isUpcoming = new Date(booking.endTime) >= new Date(); + const isOngoing = isUpcoming && new Date() >= new Date(booking.startTime); + const isBookingInPast = new Date(booking.endTime) < new Date(); + if (!isBookingInPast && !isOngoing) { + throw new HttpError({ + statusCode: 403, + message: "Cannot mark no-show before the meeting has started.", + }); + } }; export default handleMarkNoShow;