Fix/bookings unintended confirmations on rejection 6975 (#7047)

* Fixed translation message and added paymentStatus to booking page

* Fix booking confirmation with payment

* Remove previous code unnecesary
This commit is contained in:
alannnc authored and GitHub committed 2023-02-13 12:26:28 +00:00
1 parent d6594dab0f
commit c3e7981917
4 files changed
+104 -58

No files matched your search

@@ -8,6 +8,8 @@ import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import { ssrInit } from "@server/lib/ssr";
import { BookingStatus } from ".prisma/client";
export type PaymentPageProps = inferSSRProps<typeof getServerSideProps>;
const querySchema = z.object({
@@ -44,6 +46,9 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
eventTypeId: true,
location: true,
status: true,
rejectionReason: true,
cancellationReason: true,
eventType: {
select: {
id: true,
@@ -104,6 +109,19 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
hideBranding: eventType.team?.hideBranding || user?.hideBranding || null,
};
if (
([BookingStatus.CANCELLED, BookingStatus.REJECTED] as BookingStatus[]).includes(
booking.status as BookingStatus
)
) {
return {
redirect: {
destination: `/booking/${booking.uid}`,
permanent: false,
},
};
}
return {
props: {
user,