Disable redirect for cancellation page (#6498)

pull/6390/head
Hariom Balhara 2023-01-16 14:50:50 +05:30 committed by GitHub
parent 76c087f29c
commit 3e27735ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -929,6 +929,7 @@ const schema = z.object({
uid: z.string(),
email: z.string().optional(),
eventTypeSlug: z.string().optional(),
cancel: stringToBoolean,
});
const handleSeatsEventTypeOnBooking = (
@ -962,7 +963,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const ssr = await ssrInit(context);
const parsedQuery = schema.safeParse(context.query);
if (!parsedQuery.success) return { notFound: true };
const { uid, email, eventTypeSlug } = parsedQuery.data;
const { uid, email, eventTypeSlug, cancel } = parsedQuery.data;
const bookingInfo = await prisma.booking.findFirst({
where: {
@ -1048,7 +1049,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
customInputs: customInputSchema.array().parse(eventTypeRaw.customInputs),
};
if (eventType.metadata?.disableSuccessPage && eventType.successRedirectUrl) {
if (eventType.metadata?.disableSuccessPage && eventType.successRedirectUrl && !cancel) {
return {
redirect: {
destination: eventType.successRedirectUrl,

View File

@ -30,7 +30,7 @@ export default class BaseEmail {
if (process.env.NEXT_PUBLIC_IS_E2E) {
global.E2E_EMAILS = global.E2E_EMAILS || [];
global.E2E_EMAILS.push(this.getNodeMailerPayload());
console.log("Skipped Sending Email");
console.log("Skipped Sending Email as NEXT_PUBLIC_IS_E2E==1");
return new Promise((r) => r("Skipped sendEmail for E2E"));
}
new Promise((resolve, reject) =>