Skip to content

Commit 51e852f

Browse files
authored
refactor: narrow user fields returned by dynamic event endpoint (calcom#28875)
1 parent 053fb56 commit 51e852f

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

packages/features/eventtypes/lib/getPublicEvent.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,16 +345,26 @@ export const getPublicEvent = async (
345345
bookingFields: getBookingFieldsWithSystemFields({ ...defaultEvent, disableBookingTitle }),
346346
restrictionScheduleId: null,
347347
useBookerTimezone: false,
348-
// Clears meta data since we don't want to send this in the public api.
348+
// Only return fields consumed by the booker.
349349
subsetOfUsers: users.map((user) => ({
350-
...user,
351-
metadata: undefined,
350+
name: user.name,
351+
username: user.username,
352+
avatarUrl: user.avatarUrl,
353+
weekStart: user.weekStart,
354+
brandColor: user.brandColor,
355+
darkBrandColor: user.darkBrandColor,
356+
profile: user.profile,
352357
bookerUrl: getBookerBaseUrlSync(user.profile?.organization?.slug ?? null),
353358
})),
354359
users: fetchAllUsers
355360
? users.map((user) => ({
356-
...user,
357-
metadata: undefined,
361+
name: user.name,
362+
username: user.username,
363+
avatarUrl: user.avatarUrl,
364+
weekStart: user.weekStart,
365+
brandColor: user.brandColor,
366+
darkBrandColor: user.darkBrandColor,
367+
profile: user.profile,
358368
bookerUrl: getBookerBaseUrlSync(user.profile?.organization?.slug ?? null),
359369
}))
360370
: undefined,

0 commit comments

Comments
 (0)