Skip to content

Scheduling infrastructure for absolutely everyone.

chore: remove org/team booking routes from middleware (#19349)

Benny Joo8a4b03833d09
diff --git a/apps/web/app/org/[orgSlug]/[user]/[type]/page.tsx b/apps/web/app/org/[orgSlug]/[user]/[type]/page.tsx
index 48d621d737c..c33365e31e7 100644
--- a/apps/web/app/org/[orgSlug]/[user]/[type]/page.tsx
+++ b/apps/web/app/org/[orgSlug]/[user]/[type]/page.tsx
@@ -6,7 +6,7 @@ import { cookies, headers } from "next/headers";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { buildLegacyCtx, decodeParams } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/org/[orgSlug]/[user]/[type]/getServerSideProps";
import type { PageProps as TeamTypePageProps } from "~/team/type-view";
@@ -37,12 +37,14 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
})),
],
};
+ const decodedParams = decodeParams(params);
const metadata = await generateMeetingMetadata(
meeting,
(t) => `${rescheduleUid && !!booking ? t("reschedule") : ""} ${title} | ${profileName}`,
(t) => `${rescheduleUid ? t("reschedule") : ""} ${title}`,
isBrandingHidden,
- getOrgFullOrigin(eventData?.entity.orgSlug ?? null)
+ getOrgFullOrigin(eventData?.entity.orgSlug ?? null),
+ `/${decodedParams.user}/${decodedParams.type}`
);
return {
diff --git a/apps/web/app/org/[orgSlug]/[user]/page.tsx b/apps/web/app/org/[orgSlug]/[user]/page.tsx
index 519b2c2aaa7..ec1baeceb86 100644
--- a/apps/web/app/org/[orgSlug]/[user]/page.tsx
+++ b/apps/web/app/org/[orgSlug]/[user]/page.tsx
@@ -7,7 +7,7 @@ import { cookies, headers } from "next/headers";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
import { getOrgOrTeamAvatar } from "@calcom/lib/defaultAvatarImage";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { buildLegacyCtx, decodeParams } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/org/[orgSlug]/[user]/getServerSideProps";
import type { PageProps as TeamPageProps } from "~/team/team-view";
@@ -31,14 +31,15 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
image: getOrgOrTeamAvatar(team),
},
};
-
+ const decodedParams = decodeParams(params);
return {
...(await generateMeetingMetadata(
meeting,
(t) => team.name ?? t("nameless_team"),
(t) => team.name ?? t("nameless_team"),
false,
- getOrgFullOrigin(currentOrgDomain ?? null)
+ getOrgFullOrigin(currentOrgDomain ?? null),
+ `/${decodedParams.user}`
)),
robots: {
index: isSEOIndexable,
diff --git a/apps/web/app/org/[orgSlug]/instant-meeting/team/[slug]/[type]/page.tsx b/apps/web/app/org/[orgSlug]/instant-meeting/team/[slug]/[type]/page.tsx
index df2662740d6..3b9354b9002 100644
--- a/apps/web/app/org/[orgSlug]/instant-meeting/team/[slug]/[type]/page.tsx
+++ b/apps/web/app/org/[orgSlug]/instant-meeting/team/[slug]/[type]/page.tsx
@@ -6,7 +6,7 @@ import { headers, cookies } from "next/headers";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { buildLegacyCtx, decodeParams } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps";
import type { Props } from "~/org/[orgSlug]/instant-meeting/team/[slug]/[type]/instant-meeting-view";
@@ -30,12 +30,14 @@ export const generateMetadata = async ({ params, searchParams }: _PageProps) =>
})),
],
};
+ const decodedParams = decodeParams(params);
const metadata = await generateMeetingMetadata(
meeting,
() => `${title} | ${profileName}`,
() => `${title}`,
isBrandingHidden,
- getOrgFullOrigin(eventData?.entity.orgSlug ?? null)
+ getOrgFullOrigin(eventData?.entity.orgSlug ?? null),
+ `/instant-meeting/team/${decodedParams.slug}/${decodedParams.type}`
);
return {
diff --git a/apps/web/app/team/[slug]/[type]/page.tsx b/apps/web/app/team/[slug]/[type]/page.tsx
index 25815f8bfcd..56bc0ef9fcc 100644
--- a/apps/web/app/team/[slug]/[type]/page.tsx
+++ b/apps/web/app/team/[slug]/[type]/page.tsx
@@ -6,7 +6,7 @@ import { cookies, headers } from "next/headers";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { buildLegacyCtx, decodeParams } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
import LegacyPage from "~/team/type-view";
@@ -30,13 +30,14 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
})),
],
};
-
+ const decodedParams = decodeParams(params);
const metadata = await generateMeetingMetadata(
meeting,
(t) => `${booking?.uid && !!booking ? t("reschedule") : ""} ${title} | ${profileName}`,
(t) => `${booking?.uid ? t("reschedule") : ""} ${title}`,
isBrandingHidden,
- getOrgFullOrigin(eventData.entity.orgSlug ?? null)
+ getOrgFullOrigin(eventData.entity.orgSlug ?? null),
+ `/team/${decodedParams.slug}/${decodedParams.type}`
);
return {
diff --git a/apps/web/app/team/[slug]/page.tsx b/apps/web/app/team/[slug]/page.tsx
index cba4c5d3a70..a4e3eaffc6b 100644
--- a/apps/web/app/team/[slug]/page.tsx
+++ b/apps/web/app/team/[slug]/page.tsx
@@ -7,7 +7,7 @@ import { cookies, headers } from "next/headers";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
import { getOrgOrTeamAvatar } from "@calcom/lib/defaultAvatarImage";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { buildLegacyCtx, decodeParams } from "@lib/buildLegacyCtx";
import { getServerSideProps } from "@lib/team/[slug]/getServerSideProps";
import type { PageProps } from "~/team/team-view";
@@ -25,13 +25,14 @@ export const generateMetadata = async ({ params, searchParams }: _PageProps) =>
image: getOrgOrTeamAvatar(team),
},
};
-
+ const decodedParams = decodeParams(params);
const metadata = await generateMeetingMetadata(
meeting,
(t) => team.name || t("nameless_team"),
(t) => team.name || t("nameless_team"),
false,
- getOrgFullOrigin(currentOrgDomain ?? null)
+ getOrgFullOrigin(currentOrgDomain ?? null),
+ `/team/${decodedParams.slug}`
);
return {
...metadata,
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index f09d4b1c6c5..beb83ebd973 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -170,8 +170,6 @@ export const config = {
"/booking/:path*",
"/payment/:path*",
"/routing-forms/:path*",
- "/team/:path*",
- "/org/:path*",
],
};