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 <hariombalhara@gmail.com>
This commit is contained in:
Joe Au-Yeung
2025-08-19 05:52:27 +00:00
committed by GitHub
co-authored by Hariom Balhara
parent 1a573e1619
commit ff79064ca7
@@ -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)