fix: use /avatar url (#7328)

* fix: use /avatar url

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* fix: don't fetch avatar

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

* fix: type error

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>

---------

Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/7287/head^2
Udit Takkar 2023-03-09 17:47:13 +05:30 committed by GitHub
parent feb8218e4e
commit 2ddada49f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -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,