Skip to content

Scheduling infrastructure for absolutely everyone.

fix: invalid cal video bug (#13058)

Udit Takkar020515de8c59
diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx
index e8f2fbd66fc..afada8d7a13 100644
--- a/apps/web/pages/booking/[uid].tsx
+++ b/apps/web/pages/booking/[uid].tsx
@@ -486,48 +486,24 @@ export default function Success(props: SuccessProps) {
<div className="mt-3 font-medium">{t("where")}</div>
<div className="col-span-2 mt-3" data-testid="where">
{!rescheduleLocation || locationToDisplay === rescheduleLocationToDisplay ? (
- locationToDisplay.startsWith("http") ? (
- <a
- href={locationToDisplay}
- target="_blank"
- title={locationToDisplay}
- className="text-default flex items-center gap-2"
- rel="noreferrer">
- {providerName || "Link"}
- <ExternalLink className="text-default inline h-4 w-4" />
- </a>
- ) : (
- locationToDisplay
- )
+ <DisplayLocation
+ locationToDisplay={locationToDisplay}
+ providerName={providerName}
+ />
) : (
<>
- {!!formerTime &&
- (locationToDisplay.startsWith("http") ? (
- <a
- href={locationToDisplay}
- target="_blank"
- title={locationToDisplay}
- className="text-default flex items-center gap-2 line-through"
- rel="noreferrer">
- {providerName || "Link"}
- <ExternalLink className="text-default inline h-4 w-4" />
- </a>
- ) : (
- <p className="line-through">{locationToDisplay}</p>
- ))}
- {rescheduleLocationToDisplay.startsWith("http") ? (
- <a
- href={rescheduleLocationToDisplay}
- target="_blank"
- title={rescheduleLocationToDisplay}
- className="text-default flex items-center gap-2"
- rel="noreferrer">
- {rescheduleProviderName || "Link"}
- <ExternalLink className="text-default inline h-4 w-4" />
- </a>
- ) : (
- rescheduleLocationToDisplay
+ {!!formerTime && (
+ <DisplayLocation
+ locationToDisplay={locationToDisplay}
+ providerName={providerName}
+ className="line-through"
+ />
)}
+
+ <DisplayLocation
+ locationToDisplay={rescheduleLocationToDisplay}
+ providerName={rescheduleProviderName}
+ />
</>
)}
</div>
@@ -830,6 +806,29 @@ export default function Success(props: SuccessProps) {
);
}
+const DisplayLocation = ({
+ locationToDisplay,
+ providerName,
+ className,
+}: {
+ locationToDisplay: string;
+ providerName?: string;
+ className?: string;
+}) =>
+ locationToDisplay.startsWith("http") ? (
+ <a
+ href={locationToDisplay}
+ target="_blank"
+ title={locationToDisplay}
+ className={classNames("text-default flex items-center gap-2", className)}
+ rel="noreferrer">
+ {providerName || "Link"}
+ <ExternalLink className="text-default inline h-4 w-4" />
+ </a>
+ ) : (
+ <p className={className}>{locationToDisplay}</p>
+ );
+
Success.isBookingPage = true;
Success.PageWrapper = PageWrapper;
diff --git a/apps/web/pages/video/[uid].tsx b/apps/web/pages/video/[uid].tsx
index aacbb1d0286..49fd7e26eb9 100644
--- a/apps/web/pages/video/[uid].tsx
+++ b/apps/web/pages/video/[uid].tsx
@@ -333,11 +333,14 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
});
}
+ const videoReferences = bookingObj.references.filter((reference) => reference.type.includes("_video"));
+ const latestVideoReference = videoReferences[videoReferences.length - 1];
+
return {
props: {
- meetingUrl: bookingObj.references[0].meetingUrl ?? "",
- ...(typeof bookingObj.references[0].meetingPassword === "string" && {
- meetingPassword: bookingObj.references[0].meetingPassword,
+ meetingUrl: latestVideoReference.meetingUrl ?? "",
+ ...(typeof latestVideoReference.meetingPassword === "string" && {
+ meetingPassword: latestVideoReference.meetingPassword,
}),
booking: {
...bookingObj,