fix: hide organizer info on rescheduled events (#21541)

* fix(email): hide organizer info on rescheduled events

* hide organizer email on bookings-single-view

* replace organizer email with name

* sanitize previous booking only

* clean up code

* fix dumb error
This commit is contained in:
Eunjae Lee
2025-05-27 15:35:16 +00:00
committed by GitHub
parent 08e35e4698
commit 3131318b6a
2 changed files with 22 additions and 4 deletions
@@ -217,6 +217,14 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const internalNotes = await getInternalNotePresets(eventType.team?.id ?? eventType.parent?.teamId ?? null);
// Filter out organizer information if hideOrganizerEmail is true
const sanitizedPreviousBooking =
eventType.hideOrganizerEmail &&
previousBooking &&
previousBooking.rescheduledBy === bookingInfo.user?.email
? { ...previousBooking, rescheduledBy: bookingInfo.user?.name }
: previousBooking;
return {
props: {
orgSlug: currentOrgDomain,
@@ -227,7 +235,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
recurringBookings: await getRecurringBookings(bookingInfo.recurringEventId),
dynamicEventName: bookingInfo?.eventType?.eventName || "",
bookingInfo,
previousBooking,
previousBooking: sanitizedPreviousBooking,
paymentStatus: payment,
...(tz && { tz }),
userTimeFormat,
@@ -50,6 +50,18 @@ export const BaseScheduledEmail = (
)}, ${t(getRecipientStart("MMMM").toLowerCase())} ${getRecipientStart("D, YYYY")}`,
});
let rescheduledBy = props.calEvent.rescheduledBy;
if (
rescheduledBy &&
rescheduledBy === props.calEvent.organizer.email &&
props.calEvent.hideOrganizerEmail
) {
const personWhoRescheduled = [props.calEvent.organizer, ...props.calEvent.attendees].find(
(person) => person.email === rescheduledBy
);
rescheduledBy = personWhoRescheduled?.name;
}
return (
<BaseEmailHtml
hideLogo={Boolean(props.calEvent.platformClientId)}
@@ -105,9 +117,7 @@ export const BaseScheduledEmail = (
)}
</>
)}
{props.calEvent.rescheduledBy && (
<Info label={t("rescheduled_by")} description={props.calEvent.rescheduledBy} withSpacer />
)}
{rescheduledBy && <Info label={t("rescheduled_by")} description={rescheduledBy} withSpacer />}
<Info label={t("what")} description={props.calEvent.title} withSpacer />
<WhenInfo timeFormat={timeFormat} calEvent={props.calEvent} t={t} timeZone={timeZone} locale={locale} />
<WhoInfo calEvent={props.calEvent} t={t} />