From ff79064ca78d01715b96cc14efbe155dea2730ec Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Date: Tue, 19 Aug 2025 01:52:27 -0400 Subject: [PATCH] fix: Managed event types - children inherit team's appearance settings (#23116) * Get parent event type team's appearance settings * Use style profile to get brand colours * Update packages/features/eventtypes/lib/getPublicEvent.ts --------- Co-authored-by: Hariom Balhara --- .../features/eventtypes/lib/getPublicEvent.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.ts index 6511d62dd1..74982e7c8e 100644 --- a/packages/features/eventtypes/lib/getPublicEvent.ts +++ b/packages/features/eventtypes/lib/getPublicEvent.ts @@ -153,6 +153,17 @@ export const getPublicEventSelect = (fetchAllUsers: boolean) => { hidden: true, assignAllTeamMembers: true, rescheduleWithSameRoundRobinHost: true, + parent: { + select: { + team: { + select: { + theme: true, + brandColor: true, + darkBrandColor: true, + }, + }, + }, + }, } satisfies Prisma.EventTypeSelect; }; @@ -866,10 +877,11 @@ type GetProfileFromEventInput = Omit & { export function getProfileFromEvent(event: GetProfileFromEventInput) { const { team, subsetOfHosts: hosts, owner } = event; - const nonTeamprofile = hosts?.[0]?.user || owner; - const profile = team || nonTeamprofile; + const nonTeamProfile = hosts?.[0]?.user || owner; + const profile = team || nonTeamProfile; if (!profile) throw new Error("Event has no owner"); + const styleProfile = team || event.parent?.team || nonTeamProfile; const username = "username" in profile ? profile.username : team?.slug; const weekStart = hosts?.[0]?.user?.weekStart || owner?.weekStart || "Monday"; const eventMetaData = eventTypeMetaDataSchemaWithTypedApps.parse(event.metadata || {}); @@ -882,11 +894,11 @@ export function getProfileFromEvent(event: GetProfileFromEventInput) { image: team ? getOrgOrTeamAvatar(team) : getUserAvatarUrl({ - avatarUrl: nonTeamprofile?.avatarUrl, + avatarUrl: nonTeamProfile?.avatarUrl, }), - brandColor: profile.brandColor, - darkBrandColor: profile.darkBrandColor, - theme: profile.theme, + brandColor: styleProfile.brandColor, + darkBrandColor: styleProfile.darkBrandColor, + theme: styleProfile.theme, bookerLayouts: bookerLayoutsSchema.parse( eventMetaData?.bookerLayouts || (userMetaData && "defaultBookerLayouts" in userMetaData ? userMetaData.defaultBookerLayouts : null)