Skip to content

Scheduling infrastructure for absolutely everyone.

refactor: narrow user fields returned by dynamic event endpoint (#28875)

Pedro Castro51e852f67103
diff --git a/packages/features/eventtypes/lib/getPublicEvent.ts b/packages/features/eventtypes/lib/getPublicEvent.ts
index 2d106e599a4..d587b1f3610 100644
--- a/packages/features/eventtypes/lib/getPublicEvent.ts
+++ b/packages/features/eventtypes/lib/getPublicEvent.ts
@@ -345,16 +345,26 @@ export const getPublicEvent = async (
bookingFields: getBookingFieldsWithSystemFields({ ...defaultEvent, disableBookingTitle }),
restrictionScheduleId: null,
useBookerTimezone: false,
- // Clears meta data since we don't want to send this in the public api.
+ // Only return fields consumed by the booker.
subsetOfUsers: users.map((user) => ({
- ...user,
- metadata: undefined,
+ name: user.name,
+ username: user.username,
+ avatarUrl: user.avatarUrl,
+ weekStart: user.weekStart,
+ brandColor: user.brandColor,
+ darkBrandColor: user.darkBrandColor,
+ profile: user.profile,
bookerUrl: getBookerBaseUrlSync(user.profile?.organization?.slug ?? null),
})),
users: fetchAllUsers
? users.map((user) => ({
- ...user,
- metadata: undefined,
+ name: user.name,
+ username: user.username,
+ avatarUrl: user.avatarUrl,
+ weekStart: user.weekStart,
+ brandColor: user.brandColor,
+ darkBrandColor: user.darkBrandColor,
+ profile: user.profile,
bookerUrl: getBookerBaseUrlSync(user.profile?.organization?.slug ?? null),
}))
: undefined,