fix: remove event type URL for managed event types (#23357)
* fix(event-types): remove event type URL for managed event types * /teamSlug/eventTypeSlug returns 404 for managed event types * chore --------- Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
This commit is contained in:
co-authored by
Kartik Saini
parent
0bcb81bedd
commit
73b0693632
@@ -12,7 +12,7 @@ import { shouldHideBrandingForTeamEvent } from "@calcom/lib/hideBranding";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
import prisma from "@calcom/prisma";
|
||||
import type { User } from "@calcom/prisma/client";
|
||||
import { BookingStatus, RedirectType } from "@calcom/prisma/client";
|
||||
import { BookingStatus, RedirectType, SchedulingType } from "@calcom/prisma/client";
|
||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
import { handleOrgRedirect } from "@lib/handleOrgRedirect";
|
||||
@@ -54,6 +54,10 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
|
||||
const eventData = team.eventTypes[0];
|
||||
|
||||
if (eventData.schedulingType === SchedulingType.MANAGED) {
|
||||
return { notFound: true } as const;
|
||||
}
|
||||
|
||||
if (rescheduleUid && eventData.disableRescheduling) {
|
||||
return { redirect: { destination: `/booking/${rescheduleUid}`, permanent: false } };
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { useGetTheme } from "@calcom/lib/hooks/useTheme";
|
||||
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import { parseEventTypeColor } from "@calcom/lib/isEventTypeColor";
|
||||
import { localStorage } from "@calcom/lib/webstorage";
|
||||
import type { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { SchedulingType } from "@calcom/prisma/enums";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
@@ -176,13 +177,11 @@ const Item = ({
|
||||
data-testid={`event-type-title-${type.id}`}>
|
||||
{type.title}
|
||||
</span>
|
||||
{group.profile.slug ? (
|
||||
{group.profile.slug && type.schedulingType !== SchedulingType.MANAGED ? (
|
||||
<small
|
||||
className="text-subtle hidden font-normal leading-4 sm:inline"
|
||||
data-testid={`event-type-slug-${type.id}`}>
|
||||
{`/${
|
||||
type.schedulingType !== SchedulingType.MANAGED ? group.profile.slug : t("username_placeholder")
|
||||
}/${type.slug}`}
|
||||
{`/${group.profile.slug}/${type.slug}`}
|
||||
</small>
|
||||
) : null}
|
||||
{readOnly && (
|
||||
@@ -212,7 +211,7 @@ const Item = ({
|
||||
data-testid={`event-type-title-${type.id}`}>
|
||||
{type.title}
|
||||
</span>
|
||||
{group.profile.slug ? (
|
||||
{group.profile.slug && type.schedulingType !== SchedulingType.MANAGED ? (
|
||||
<small
|
||||
className="text-subtle hidden font-normal leading-4 sm:inline"
|
||||
data-testid={`event-type-slug-${type.id}`}>
|
||||
|
||||
Reference in New Issue
Block a user