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

* fix: incorrect booking title for diff users

* Update common.json

* update
This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2024-11-11 19:10:45 +00:00
1 parent fc5ad53a6d
commit 6c40d29745
2 files changed
+22 -3

No files matched your search

@@ -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}`);