From a1614767acb499e97d928822a61b525e4fab4e86 Mon Sep 17 00:00:00 2001 From: Hariom Date: Tue, 24 Oct 2023 19:50:32 +0530 Subject: [PATCH] Avatar fixes at more places --- apps/web/pages/event-types/index.tsx | 17 +++-------------- packages/lib/getEventTypeById.ts | 14 ++++---------- .../viewer/eventTypes/getByViewer.handler.ts | 1 + 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx index bd87521314..4d68795e92 100644 --- a/apps/web/pages/event-types/index.tsx +++ b/apps/web/pages/event-types/index.tsx @@ -72,6 +72,7 @@ import useMeQuery from "@lib/hooks/useMeQuery"; import PageWrapper from "@components/PageWrapper"; import SkeletonLoader from "@components/eventtype/SkeletonLoader"; +import { UserAvatarGroup } from "@components/ui/avatar/UserAvatarGroup"; type EventTypeGroups = RouterOutputs["viewer"]["eventTypes"]["getByViewer"]["eventTypeGroups"]; type EventTypeGroupProfile = EventTypeGroups[number]["profile"]; @@ -398,23 +399,11 @@ export const EventTypeList = ({ group, groupIndex, readOnly, types }: EventTypeL
{type.team && !isManagedEventType && ( - ({ - alt: organizer.name || "", - image: `${orgBranding?.fullDomain ?? WEBAPP_URL}/${ - organizer.username - }/avatar.png`, - title: organizer.name || "", - }) - ) - : [] - } + users={type?.users ?? []} /> )} {isManagedEventType && type?.children && type.children?.length > 0 && ( diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts index 7637446d80..7ce86719fd 100644 --- a/packages/lib/getEventTypeById.ts +++ b/packages/lib/getEventTypeById.ts @@ -4,10 +4,9 @@ import { getLocationGroupedOptions } from "@calcom/app-store/server"; import type { StripeData } from "@calcom/app-store/stripepayment/lib/server"; import { getEventTypeAppData } from "@calcom/app-store/utils"; import type { LocationObject } from "@calcom/core/location"; -import { getOrgFullOrigin } from "@calcom/ee/organizations/lib/orgDomains"; import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields"; import { parseBookingLimit, parseDurationLimit, parseRecurringEvent } from "@calcom/lib"; -import { CAL_URL } from "@calcom/lib/constants"; +import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl"; import { getTranslation } from "@calcom/lib/server/i18n"; import type { PrismaClient } from "@calcom/prisma"; import type { Credential } from "@calcom/prisma/client"; @@ -36,6 +35,7 @@ export default async function getEventTypeById({ username: true, id: true, email: true, + organizationId: true, locale: true, defaultScheduleId: true, }); @@ -298,9 +298,7 @@ export default async function getEventTypeById({ const eventTypeUsers: ((typeof eventType.users)[number] & { avatar: string })[] = eventType.users.map( (user) => ({ ...user, - avatar: `${eventType.team?.parent?.slug ? getOrgFullOrigin(eventType.team?.parent?.slug) : CAL_URL}/${ - user.username - }/avatar.png`, + avatar: getUserAvatarUrl(user), }) ); @@ -346,11 +344,7 @@ export default async function getEventTypeById({ .map((member) => { const user: typeof member.user & { avatar: string } = { ...member.user, - avatar: `${ - eventTypeObject.team?.parent?.slug - ? getOrgFullOrigin(eventTypeObject.team?.parent?.slug) - : CAL_URL - }/${member.user.username}/avatar.png`, + avatar: getUserAvatarUrl(member.user), }; return { ...user, diff --git a/packages/trpc/server/routers/viewer/eventTypes/getByViewer.handler.ts b/packages/trpc/server/routers/viewer/eventTypes/getByViewer.handler.ts index 6c154cdb30..83f8089c88 100644 --- a/packages/trpc/server/routers/viewer/eventTypes/getByViewer.handler.ts +++ b/packages/trpc/server/routers/viewer/eventTypes/getByViewer.handler.ts @@ -30,6 +30,7 @@ const userSelect = Prisma.validator()({ id: true, username: true, name: true, + organizationId: true, }); const userEventTypeSelect = Prisma.validator()({