From bb9f8e5d389cd32c95a5fa65fc0a479a432cfd61 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Wed, 14 Feb 2024 06:01:24 +0000 Subject: [PATCH] fix: dont link to org url inside embeds (#13668) * dont link to org url inside embeds * Add comment * Fix type issue --------- Co-authored-by: Hariom --- packages/ui/components/avatar/Avatar.tsx | 2 +- packages/ui/components/avatar/AvatarGroup.tsx | 2 +- packages/ui/components/avatar/UserAvatarGroupWithOrg.tsx | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/ui/components/avatar/Avatar.tsx b/packages/ui/components/avatar/Avatar.tsx index 6ebd05d114..6fd5c75ce0 100644 --- a/packages/ui/components/avatar/Avatar.tsx +++ b/packages/ui/components/avatar/Avatar.tsx @@ -15,7 +15,7 @@ export type AvatarProps = { imageSrc?: Maybe; title?: string; alt: string; - href?: string; + href?: string | null; fallback?: React.ReactNode; accepted?: boolean; asChild?: boolean; // Added to ignore the outer span on the fallback component - messes up styling diff --git a/packages/ui/components/avatar/AvatarGroup.tsx b/packages/ui/components/avatar/AvatarGroup.tsx index 113886e67b..5ecf80891a 100644 --- a/packages/ui/components/avatar/AvatarGroup.tsx +++ b/packages/ui/components/avatar/AvatarGroup.tsx @@ -8,7 +8,7 @@ export type AvatarGroupProps = { image: string; title?: string; alt?: string; - href?: string; + href?: string | null; }[]; className?: string; truncateAfter?: number; diff --git a/packages/ui/components/avatar/UserAvatarGroupWithOrg.tsx b/packages/ui/components/avatar/UserAvatarGroupWithOrg.tsx index 416311001a..cb898760f4 100644 --- a/packages/ui/components/avatar/UserAvatarGroupWithOrg.tsx +++ b/packages/ui/components/avatar/UserAvatarGroupWithOrg.tsx @@ -1,3 +1,4 @@ +import { useIsEmbed } from "@calcom/embed-core/embed-iframe"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { getBookerBaseUrlSync } from "@calcom/lib/getBookerUrl/client"; @@ -15,9 +16,12 @@ type UserAvatarProps = Omit, "items"> & export function UserAvatarGroupWithOrg(props: UserAvatarProps) { const { users, organization, ...rest } = props; + const isEmbed = useIsEmbed(); + const items = [ { - href: getBookerBaseUrlSync(organization.slug), + // We don't want booker to be able to see the list of other users or teams inside the embed + href: isEmbed ? null : getBookerBaseUrlSync(organization.slug), image: `${WEBAPP_URL}/team/${organization.slug}/avatar.png`, alt: organization.name || undefined, title: organization.name,