Skip to content

Commit

Permalink
fix: rescheduledBy to carry into success url redirect (#16931)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpadoinkle authored Oct 4, 2024
1 parent 664a92a commit 743b155
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/web/modules/bookings/views/bookings-single-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ export default function Success(props: PageProps) {
const [calculatedDuration, setCalculatedDuration] = useState<number | undefined>(undefined);
const [comment, setComment] = useState("");
const parsedRating = rating ? parseInt(rating, 10) : 3;
const currentUserEmail = searchParams?.get("cancelledBy") ?? session?.user?.email ?? undefined;
const currentUserEmail =
searchParams?.get("rescheduledBy") ??
searchParams?.get("cancelledBy") ??
session?.user?.email ??
undefined;

const defaultRating = isNaN(parsedRating) ? 3 : parsedRating > 5 ? 5 : parsedRating < 1 ? 1 : parsedRating;
const [rateValue, setRateValue] = useState<number>(defaultRating);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const useBookings = ({ event, hashedLink, bookingForm, metadata, teamMemb
const isInstantMeeting = useBookerStore((state) => state.isInstantMeeting);

const rescheduleUid = useBookerStore((state) => state.rescheduleUid);
const rescheduledBy = useBookerStore((state) => state.rescheduledBy);
const bookingData = useBookerStore((state) => state.bookingData);
const timeslot = useBookerStore((state) => state.selectedTimeslot);
const { t } = useLocale();
Expand Down Expand Up @@ -260,6 +261,7 @@ export const useBookings = ({ event, hashedLink, bookingForm, metadata, teamMemb
seatReferenceUid: "seatReferenceUid" in booking ? booking.seatReferenceUid : null,
formerTime:
isRescheduling && bookingData?.startTime ? dayjs(bookingData.startTime).toString() : undefined,
rescheduledBy, // ensure further reschedules performed on the success page are recorded correctly
};

bookingSuccessRedirect({
Expand Down

0 comments on commit 743b155

Please sign in to comment.