fix: rescheduling recurring events (#12567)

This commit is contained in:
Somay Chauhan 2023-11-30 23:57:37 +05:30 committed by GitHub
parent 338756439f
commit 1c20bdcecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -525,8 +525,8 @@ const RecurringBookingsTooltip = ({
return (
recurringDate >= now &&
!booking.recurringInfo?.bookings[BookingStatus.CANCELLED]
.map((date) => date.toDateString())
.includes(recurringDate.toDateString())
.map((date) => date.toString())
.includes(recurringDate.toString())
);
}).length;
@ -543,8 +543,8 @@ const RecurringBookingsTooltip = ({
const pastOrCancelled =
aDate < now ||
booking.recurringInfo?.bookings[BookingStatus.CANCELLED]
.map((date) => date.toDateString())
.includes(aDate.toDateString());
.map((date) => date.toString())
.includes(aDate.toString());
return (
<p key={key} className={classNames(pastOrCancelled && "line-through")}>
{formatTime(aDate, userTimeFormat, userTimeZone)}

View File

@ -1244,6 +1244,7 @@ async function getRecurringBookings(recurringEventId: string | null) {
const recurringBookings = await prisma.booking.findMany({
where: {
recurringEventId,
status: BookingStatus.ACCEPTED,
},
select: {
startTime: true,

View File

@ -344,7 +344,7 @@ export const BookEventFormChild = ({
hashedLink,
};
if (eventQuery.data?.recurringEvent?.freq && recurringEventCount) {
if (eventQuery.data?.recurringEvent?.freq && recurringEventCount && !rescheduleUid) {
createRecurringBookingMutation.mutate(
mapRecurringBookingToMutationInput(bookingInput, recurringEventCount)
);

View File

@ -1,6 +1,7 @@
import { Fragment } from "react";
import React from "react";
import { useBookerStore } from "@calcom/features/bookings/Booker/store";
import classNames from "@calcom/lib/classNames";
import getPaymentAppData from "@calcom/lib/getPaymentAppData";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@ -110,6 +111,7 @@ export const EventMetaBlock = ({
*/
export const EventDetails = ({ event, blocks = defaultEventDetailsBlocks }: EventDetailsProps) => {
const { t } = useLocale();
const rescheduleUid = useBookerStore((state) => state.rescheduleUid);
return (
<>
@ -144,7 +146,7 @@ export const EventDetails = ({ event, blocks = defaultEventDetailsBlocks }: Even
);
case EventDetailBlocks.OCCURENCES:
if (!event.recurringEvent) return null;
if (!event.recurringEvent || rescheduleUid) return null;
return (
<EventMetaBlock key={block} icon={RefreshCcw}>