Skip to content

Commit

Permalink
chore: remove org/team booking routes from middleware (calcom#19349)
Browse files Browse the repository at this point in the history
* chore: remove user routes from middleware

* chore: remove org and team routes from middleware
  • Loading branch information
hbjORbj authored and MuhammadAimanSulaiman committed Feb 25, 2025
1 parent f115029 commit 92811b6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
6 changes: 4 additions & 2 deletions apps/web/app/org/[orgSlug]/[user]/[type]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions apps/web/app/org/[orgSlug]/[user]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions apps/web/app/team/[slug]/[type]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions apps/web/app/team/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ export const config = {
"/booking/:path*",
"/payment/:path*",
"/routing-forms/:path*",
"/team/:path*",
"/org/:path*",
],
};

Expand Down

0 comments on commit 92811b6

Please sign in to comment.