Skip to content

Scheduling infrastructure for absolutely everyone.

fix: incorrect booking title for diff users (#17448)

Anik Dhabal Babu6c40d297455a
diff --git a/apps/web/modules/bookings/views/bookings-single-view.tsx b/apps/web/modules/bookings/views/bookings-single-view.tsx
index baae4d7feef..10295922337 100644
--- a/apps/web/modules/bookings/views/bookings-single-view.tsx
+++ b/apps/web/modules/bookings/views/bookings-single-view.tsx
@@ -315,8 +315,23 @@ export default function Success(props: PageProps) {
return t(`needs_to_be_confirmed_or_rejected${titleSuffix}`);
}
if (bookingInfo.user) {
- return t(`${titlePrefix}emailed_you_and_attendees${titleSuffix}`, {
- user: bookingInfo.user.name || bookingInfo.user.email,
+ const isHost = bookingInfo.user.id === session?.user?.id;
+ const isAttendee = bookingInfo.attendees.find((attendee) => attendee.email === session?.user?.email);
+ const attendee = bookingInfo.attendees[0]?.name || bookingInfo.attendees[0]?.email || "Nameless";
+ const host = bookingInfo.user.name || bookingInfo.user.email;
+ if (isHost) {
+ return t(`${titlePrefix}emailed_you_and_attendees${titleSuffix}`, {
+ user: attendee,
+ });
+ }
+ if (isAttendee) {
+ return t(`${titlePrefix}emailed_you_and_attendees${titleSuffix}`, {
+ user: host,
+ });
+ }
+ return t(`${titlePrefix}emailed_host_and_attendee${titleSuffix}`, {
+ host,
+ attendee,
});
}
return t(`emailed_you_and_attendees${titleSuffix}`);
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index 82ad247438d..341c50482c4 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -350,9 +350,13 @@
"other": "Other",
"email_sign_in_subject": "Your sign-in link for {{appName}}",
"round_robin_emailed_you_and_attendees": "You are meeting with {{user}}. We sent an email with a calendar invitation with the details to everyone.",
+ "round_robin_emailed_host_and_attendee": "{{host}} is meeting with {{attendee}}. We sent an email with a calendar invitation with the details to everyone.",
"emailed_you_and_attendees": "We sent an email with a calendar invitation with the details to everyone.",
+ "emailed_host_and_attendee": "We sent an email with a calendar invitation with the details to everyone.",
"emailed_you_and_attendees_recurring": "We sent an email with a calendar invitation with the details to everyone for the first of these recurring events.",
- "round_robin_emailed_you_and_attendees_recurring": "You are meeting with {{user}}.We sent an email with a calendar invitation with the details to everyone for the first of these recurring events.",
+ "emailed_host_and_attendee_recurring": "We sent an email with a calendar invitation with the details to everyone for the first of these recurring events.",
+ "round_robin_emailed_you_and_attendees_recurring": "You are meeting with {{user}}. We sent an email with a calendar invitation with the details to everyone for the first of these recurring events.",
+ "round_robin_emailed_host_and_attendee_recurring": "{{host}} is meeting with {{attendee}}. We sent an email with a calendar invitation with the details to everyone for the first of these recurring events.",
"emailed_you_and_any_other_attendees": "We sent an email to everyone with this information.",
"needs_to_be_confirmed_or_rejected": "Your booking still needs to be confirmed or rejected.",
"needs_to_be_confirmed_or_rejected_recurring": "Your recurring meeting still needs to be confirmed or rejected.",