diff --git a/apps/web/components/ui/avatar/UserAvatarGroup.tsx b/apps/web/components/ui/avatar/UserAvatarGroup.tsx index ad3909641e..e9346fb401 100644 --- a/apps/web/components/ui/avatar/UserAvatarGroup.tsx +++ b/apps/web/components/ui/avatar/UserAvatarGroup.tsx @@ -1,3 +1,4 @@ +import { CAL_URL } from "@calcom/lib/constants"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import type { User } from "@calcom/prisma/client"; import { AvatarGroup } from "@calcom/ui"; @@ -11,6 +12,7 @@ export function UserAvatarGroup(props: UserAvatarProps) { ({ + href: `${CAL_URL}/${user.username}?redirect=false`, alt: user.name || "", title: user.name || "", image: getUserAvatarUrl(user), diff --git a/apps/web/components/ui/avatar/UserAvatarGroupWithOrg.tsx b/apps/web/components/ui/avatar/UserAvatarGroupWithOrg.tsx index 9de57a0b57..6b265395d8 100644 --- a/apps/web/components/ui/avatar/UserAvatarGroupWithOrg.tsx +++ b/apps/web/components/ui/avatar/UserAvatarGroupWithOrg.tsx @@ -1,4 +1,5 @@ -import { WEBAPP_URL } from "@calcom/lib/constants"; +import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; +import { CAL_URL, WEBAPP_URL } from "@calcom/lib/constants"; import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import type { Team, User } from "@calcom/prisma/client"; import { AvatarGroup } from "@calcom/ui"; @@ -10,8 +11,11 @@ type UserAvatarProps = Omit, "items"> & export function UserAvatarGroupWithOrg(props: UserAvatarProps) { const { users, organization, ...rest } = props; + const orgBranding = useOrgBranding(); + const baseUrl = `${orgBranding?.fullDomain ?? CAL_URL}`; const items = [ { + href: baseUrl, image: `${WEBAPP_URL}/team/${organization.slug}/avatar.png`, alt: organization.name || undefined, title: organization.name, @@ -19,6 +23,7 @@ export function UserAvatarGroupWithOrg(props: UserAvatarProps) { ].concat( users.map((user) => { return { + href: `${baseUrl}/${user.username}/?redirect=false`, image: getUserAvatarUrl(user), alt: user.name || undefined, title: user.name || user.username || "", diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsx index 5a4f46eed0..810500fa9b 100644 --- a/apps/web/pages/[user].tsx +++ b/apps/web/pages/[user].tsx @@ -54,6 +54,7 @@ export function UserPage(props: InferGetServerSidePropsType = async (cont descriptionAsSafeHTML: markdownToSafeHTML(eventType.description), })); + // if profile only has one public event-type, redirect to it + if (eventTypes.length === 1 && context.query.redirect !== "false") { + return { + redirect: { + permanent: false, + destination: `/${user.username}/${eventTypes[0].slug}`, + }, + }; + } + const safeBio = markdownToSafeHTML(user.bio) || ""; const markdownStrippedBio = stripMarkdown(user?.bio || ""); diff --git a/apps/web/pages/org/[orgSlug]/[user]/index.tsx b/apps/web/pages/org/[orgSlug]/[user]/index.tsx index 7174a217d7..df0d6d6b97 100644 --- a/apps/web/pages/org/[orgSlug]/[user]/index.tsx +++ b/apps/web/pages/org/[orgSlug]/[user]/index.tsx @@ -26,7 +26,7 @@ export const getServerSideProps = async (ctx: GetServerSidePropsContext) => { if (team) { return GSSTeamPage({ ...ctx, query: { slug: ctx.query.user } }); } - return GSSUserPage({ ...ctx, query: { user: ctx.query.user } }); + return GSSUserPage({ ...ctx, query: { user: ctx.query.user, redirect: ctx.query.redirect } }); }; type Props = UserPageProps | TeamPageProps;