From 6c40d297455ae4c00ee702258b5b0342762c7248 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Tue, 12 Nov 2024 00:40:45 +0530 Subject: [PATCH] fix: incorrect booking title for diff users (#17448) * fix: incorrect booking title for diff users * Update common.json * update --- .../bookings/views/bookings-single-view.tsx | 19 +++++++++++++++++-- apps/web/public/static/locales/en/common.json | 6 +++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/apps/web/modules/bookings/views/bookings-single-view.tsx b/apps/web/modules/bookings/views/bookings-single-view.tsx index baae4d7fee..1029592233 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 82ad247438..341c50482c 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.",