Skip to content

Commit 73b0693

Browse files
fix: remove event type URL for managed event types (calcom#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>
1 parent 0bcb81b commit 73b0693

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

apps/web/lib/team/[slug]/[type]/getServerSideProps.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { shouldHideBrandingForTeamEvent } from "@calcom/lib/hideBranding";
1212
import slugify from "@calcom/lib/slugify";
1313
import prisma from "@calcom/prisma";
1414
import type { User } from "@calcom/prisma/client";
15-
import { BookingStatus, RedirectType } from "@calcom/prisma/client";
15+
import { BookingStatus, RedirectType, SchedulingType } from "@calcom/prisma/client";
1616
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
1717

1818
import { handleOrgRedirect } from "@lib/handleOrgRedirect";
@@ -54,6 +54,10 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
5454

5555
const eventData = team.eventTypes[0];
5656

57+
if (eventData.schedulingType === SchedulingType.MANAGED) {
58+
return { notFound: true } as const;
59+
}
60+
5761
if (rescheduleUid && eventData.disableRescheduling) {
5862
return { redirect: { destination: `/booking/${rescheduleUid}`, permanent: false } };
5963
}

apps/web/modules/event-types/views/event-types-listing-view.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { useGetTheme } from "@calcom/lib/hooks/useTheme";
2626
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
2727
import { HttpError } from "@calcom/lib/http-error";
2828
import { parseEventTypeColor } from "@calcom/lib/isEventTypeColor";
29+
import { localStorage } from "@calcom/lib/webstorage";
2930
import type { MembershipRole } from "@calcom/prisma/enums";
3031
import { SchedulingType } from "@calcom/prisma/enums";
3132
import type { RouterOutputs } from "@calcom/trpc/react";
@@ -176,13 +177,11 @@ const Item = ({
176177
data-testid={`event-type-title-${type.id}`}>
177178
{type.title}
178179
</span>
179-
{group.profile.slug ? (
180+
{group.profile.slug && type.schedulingType !== SchedulingType.MANAGED ? (
180181
<small
181182
className="text-subtle hidden font-normal leading-4 sm:inline"
182183
data-testid={`event-type-slug-${type.id}`}>
183-
{`/${
184-
type.schedulingType !== SchedulingType.MANAGED ? group.profile.slug : t("username_placeholder")
185-
}/${type.slug}`}
184+
{`/${group.profile.slug}/${type.slug}`}
186185
</small>
187186
) : null}
188187
{readOnly && (
@@ -212,7 +211,7 @@ const Item = ({
212211
data-testid={`event-type-title-${type.id}`}>
213212
{type.title}
214213
</span>
215-
{group.profile.slug ? (
214+
{group.profile.slug && type.schedulingType !== SchedulingType.MANAGED ? (
216215
<small
217216
className="text-subtle hidden font-normal leading-4 sm:inline"
218217
data-testid={`event-type-slug-${type.id}`}>

0 commit comments

Comments
 (0)