Skip to content

Commit 060176c

Browse files
authored
Fix: Hide team members in social preview when team is private (calcom#25770)
1 parent a306a77 commit 060176c

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

apps/web/app/(booking-page-wrapper)/org/[orgSlug]/instant-meeting/team/[slug]/[type]/page.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Page from "~/org/[orgSlug]/instant-meeting/team/[slug]/[type]/instant-mee
1313

1414
export const generateMetadata = async ({ params, searchParams }: _PageProps) => {
1515
const context = buildLegacyCtx(await headers(), await cookies(), await params, await searchParams);
16-
const { isBrandingHidden, eventData } = await getData(context);
16+
const { isBrandingHidden, eventData, teamIsPrivate } = await getData(context);
1717

1818
const profileName = eventData?.profile.name ?? "";
1919
const profileImage = eventData?.profile.image;
@@ -22,12 +22,15 @@ export const generateMetadata = async ({ params, searchParams }: _PageProps) =>
2222
const meeting = {
2323
title,
2424
profile: { name: profileName, image: profileImage },
25-
users: [
26-
...(eventData?.users || []).map((user) => ({
27-
name: `${user.name}`,
28-
username: `${user.username}`,
29-
})),
30-
],
25+
// Hide team member names in preview if team is private
26+
users: teamIsPrivate
27+
? []
28+
: [
29+
...(eventData?.users || []).map((user) => ({
30+
name: `${user.name}`,
31+
username: `${user.username}`,
32+
})),
33+
],
3134
};
3235
const decodedParams = decodeParams(await params);
3336
const metadata = await generateMeetingMetadata(

apps/web/app/(booking-page-wrapper)/team/[slug]/[type]/pageWithCachedData.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,20 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
9191
const profileName = enrichedEventType.profile.name ?? "";
9292
const profileImage = enrichedEventType.profile.image;
9393

94+
const teamIsPrivate = teamData.isPrivate;
95+
9496
const meeting = {
9597
title,
9698
profile: { name: profileName, image: profileImage },
97-
users: [
98-
...(enrichedEventType?.subsetOfUsers || []).map((user) => ({
99-
name: `${user.name}`,
100-
username: `${user.username}`,
101-
})),
102-
],
99+
// Hide team member names in preview if team is private
100+
users: teamIsPrivate
101+
? []
102+
: [
103+
...(enrichedEventType?.subsetOfUsers || []).map((user) => ({
104+
name: `${user.name}`,
105+
username: `${user.username}`,
106+
})),
107+
],
103108
};
104109

105110
const { hideBranding, isSEOIndexable } = _getTeamMetadataForBooking(teamData, enrichedEventType.id);

apps/web/lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
2828
},
2929
select: {
3030
id: true,
31+
isPrivate: true,
3132
hideBranding: true,
3233
parent: {
3334
select: {
@@ -86,6 +87,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
8687
team,
8788
}),
8889
themeBasis: null,
90+
teamIsPrivate: team.isPrivate,
8991
},
9092
};
9193
};

0 commit comments

Comments
 (0)