Scheduling infrastructure for absolutely everyone.
fix: Managed event types - children inherit team's appearance settings (#23116)
Joe Au-Yeungff79064ca78d
diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.tsindex 6511d62dd1a..74982e7c8eb 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<Event, "hosts"> & {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)