fix: username is visible in private booking link (#19054)

This commit is contained in:
Benny Joo authored and GitHub committed 2025-02-02 22:36:24 -07:00
1 parent f0dc3bba17
commit ca650babaf
3 files changed
+20 -7

No files matched your search

@@ -78,6 +78,7 @@ const BookerComponent = ({
hasValidLicense, hasValidLicense,
isBookingDryRun: isBookingDryRunProp, isBookingDryRun: isBookingDryRunProp,
renderCaptcha, renderCaptcha,
hashedLink,
}: BookerProps & WrappedBookerProps) => { }: BookerProps & WrappedBookerProps) => {
const searchParams = useCompatSearchParams(); const searchParams = useCompatSearchParams();
const isPlatformBookerEmbed = useIsPlatformBookerEmbed(); const isPlatformBookerEmbed = useIsPlatformBookerEmbed();
@@ -389,6 +390,7 @@ const BookerComponent = ({
event={event.data} event={event.data}
isPending={event.isPending} isPending={event.isPending}
isPlatform={isPlatform} isPlatform={isPlatform}
isPrivateLink={!!hashedLink}
locale={userLocale} locale={userLocale}
/> />
{layout !== BookerLayouts.MONTH_VIEW && {layout !== BookerLayouts.MONTH_VIEW &&
@@ -47,6 +47,7 @@ export const EventMeta = ({
event, event,
isPending, isPending,
isPlatform = true, isPlatform = true,
isPrivateLink,
classNames, classNames,
locale, locale,
}: { }: {
@@ -73,6 +74,7 @@ export const EventMeta = ({
| "autoTranslateDescriptionEnabled" | "autoTranslateDescriptionEnabled"
> | null; > | null;
isPending: boolean; isPending: boolean;
isPrivateLink: boolean;
isPlatform?: boolean; isPlatform?: boolean;
classNames?: { classNames?: {
eventMetaContainer?: string; eventMetaContainer?: string;
@@ -153,6 +155,7 @@ export const EventMeta = ({
users={event.subsetOfUsers} users={event.subsetOfUsers}
profile={event.profile} profile={event.profile}
entity={event.entity} entity={event.entity}
isPrivateLink={isPrivateLink}
/> />
<EventTitle className={`${classNames?.eventMetaTitle} my-2`}> <EventTitle className={`${classNames?.eventMetaTitle} my-2`}>
{translatedTitle ?? event?.title} {translatedTitle ?? event?.title}
@@ -17,9 +17,16 @@ export interface EventMembersProps {
users: BookerEvent["subsetOfUsers"]; users: BookerEvent["subsetOfUsers"];
profile: BookerEvent["profile"]; profile: BookerEvent["profile"];
entity: BookerEvent["entity"]; entity: BookerEvent["entity"];
isPrivateLink: boolean;
} }
export const EventMembers = ({ schedulingType, users, profile, entity }: EventMembersProps) => { export const EventMembers = ({
schedulingType,
users,
profile,
entity,
isPrivateLink,
}: EventMembersProps) => {
const username = useBookerStore((state) => state.username); const username = useBookerStore((state) => state.username);
const isDynamic = !!(username && username.indexOf("+") > -1); const isDynamic = !!(username && username.indexOf("+") > -1);
const isEmbed = useIsEmbed(); const isEmbed = useIsEmbed();
@@ -40,7 +47,7 @@ export const EventMembers = ({ schedulingType, users, profile, entity }: EventMe
{ {
// We don't want booker to be able to see the list of other users or teams inside the embed // We don't want booker to be able to see the list of other users or teams inside the embed
href: href:
isEmbed || isPlatform isEmbed || isPlatform || isPrivateLink
? null ? null
: entity.teamSlug : entity.teamSlug
? getTeamUrlSync({ orgSlug: entity.orgSlug, teamSlug: entity.teamSlug }) ? getTeamUrlSync({ orgSlug: entity.orgSlug, teamSlug: entity.teamSlug })
@@ -59,11 +66,12 @@ export const EventMembers = ({ schedulingType, users, profile, entity }: EventMe
items={[ items={[
...orgOrTeamAvatarItem, ...orgOrTeamAvatarItem,
...shownUsers.map((user) => ({ ...shownUsers.map((user) => ({
href: isPlatform href:
? null isPlatform || isPrivateLink
: `${getBookerBaseUrlSync(user.profile?.organization?.slug ?? null)}/${ ? null
user.profile?.username : `${getBookerBaseUrlSync(user.profile?.organization?.slug ?? null)}/${
}?redirect=false`, user.profile?.username
}?redirect=false`,
alt: user.name || "", alt: user.name || "",
title: user.name || "", title: user.name || "",
image: getUserAvatarUrl(user), image: getUserAvatarUrl(user),