Skip to content

Scheduling infrastructure for absolutely everyone.

fix: use /avatar url (#7328)

Udit Takkar2ddada49f926
diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsx
index 2f629c4c251..8e032088f85 100644
--- a/apps/web/pages/[user].tsx
+++ b/apps/web/pages/[user].tsx
@@ -15,6 +15,7 @@ import {
import { EventTypeDescriptionLazy as EventTypeDescription } from "@calcom/features/eventtypes/components";
import EmptyPage from "@calcom/features/eventtypes/components/EmptyPage";
import CustomBranding from "@calcom/lib/CustomBranding";
+import { WEBAPP_URL } from "@calcom/lib/constants";
import defaultEvents, {
getDynamicEventDescription,
getGroupName,
@@ -76,7 +77,7 @@ export default function User(props: inferSSRProps<typeof getServerSideProps> & E
size="sm"
items={props.users.map((user) => ({
alt: user.name || "",
- image: user.avatar || "",
+ image: user.avatar,
}))}
/>
</div>
@@ -261,7 +262,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const usernameList = getUsernameList(context.query.user as string);
const dataFetchStart = Date.now();
- const users = await prisma.user.findMany({
+ const usersWithoutAvatar = await prisma.user.findMany({
where: {
username: {
in: usernameList,
@@ -275,7 +276,6 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
bio: true,
brandColor: true,
darkBrandColor: true,
- avatar: true,
theme: true,
away: true,
verified: true,
@@ -283,6 +283,11 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
},
});
+ const users = usersWithoutAvatar.map((user) => ({
+ ...user,
+ avatar: `${WEBAPP_URL}/${user.username}/avatar.png`,
+ }));
+
if (!users.length) {
return {
notFound: true,