@@ -10,6 +10,7 @@ import type { FreeBusyArgs } from "@calcom/features/calendar-cache/calendar-cach
1010import { getTimeMax , getTimeMin } from "@calcom/features/calendar-cache/lib/datesForCache" ;
1111import { getLocation , getRichDescription } from "@calcom/lib/CalEventParser" ;
1212import { uniqueBy } from "@calcom/lib/array" ;
13+ import { ORGANIZER_EMAIL_EXEMPT_DOMAINS } from "@calcom/lib/constants" ;
1314import logger from "@calcom/lib/logger" ;
1415import { safeStringify } from "@calcom/lib/safeStringify" ;
1516import { SelectedCalendarRepository } from "@calcom/lib/server/repository/selectedCalendar" ;
@@ -85,10 +86,16 @@ export default class GoogleCalendarService implements Calendar {
8586 const selectedHostDestinationCalendar = event . destinationCalendar ?. find (
8687 ( cal ) => cal . credentialId === this . credential . id
8788 ) ;
89+
90+ const isOrganizerExempt = ORGANIZER_EMAIL_EXEMPT_DOMAINS ?. split ( "," )
91+ . filter ( ( domain ) => domain . trim ( ) !== "" )
92+ . some ( ( domain ) => event . organizer . email . toLowerCase ( ) . endsWith ( domain . toLowerCase ( ) ) ) ;
93+
8894 const eventAttendees = event . attendees . map ( ( { id : _id , ...rest } ) => ( {
8995 ...rest ,
9096 responseStatus : "accepted" ,
9197 } ) ) ;
98+
9299 const attendees : calendar_v3 . Schema$EventAttendee [ ] = [
93100 {
94101 ...event . organizer ,
@@ -100,7 +107,7 @@ export default class GoogleCalendarService implements Calendar {
100107 // We use || instead of ?? here to handle empty strings
101108 email : hostExternalCalendarId || selectedHostDestinationCalendar ?. externalId || event . organizer . email ,
102109 } ,
103- ...eventAttendees ,
110+ ...( event . hideOrganizerEmail && ! isOrganizerExempt ? [ ] : eventAttendees ) ,
104111 ] ;
105112
106113 if ( event . team ?. members ) {
0 commit comments