From f1111c9d4232b1cb312b7b730baf778dc0d0cdbb Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:44:49 +0000 Subject: [PATCH] show who a RR was reassigned to on auto (#17454) --- apps/web/components/dialog/ReassignDialog.tsx | 4 ++-- apps/web/public/static/locales/en/common.json | 1 + .../features/ee/round-robin/roundRobinReassignment.ts | 9 +++++++++ .../teams/roundRobin/roundRobinReassign.handler.ts | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/web/components/dialog/ReassignDialog.tsx b/apps/web/components/dialog/ReassignDialog.tsx index e966c397ac..ca5ab4c7fb 100644 --- a/apps/web/components/dialog/ReassignDialog.tsx +++ b/apps/web/components/dialog/ReassignDialog.tsx @@ -106,10 +106,10 @@ export const ReassignDialog = ({ isOpenDialog, setIsOpenDialog, teamId, bookingI }); const roundRobinReassignMutation = trpc.viewer.teams.roundRobinReassign.useMutation({ - onSuccess: async () => { + onSuccess: async (data) => { await utils.viewer.bookings.get.invalidate(); setIsOpenDialog(false); - showToast(t("booking_reassigned"), "success"); + showToast(t("booking_reassigned_to_host", { host: data?.reassignedTo.name }), "success"); }, onError: async (error) => { if (error.message.includes(ErrorCode.NoAvailableUsersFound)) { diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 06eff9133d..67406948f4 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2744,5 +2744,6 @@ "event_end_time_in_attendee_timezone_info": "Event End Time In Attendee Timezone", "salesforce_create_event_on_contact": "Create event on contact, if it exists. Else fallback to lead", "salesforce_owner_name_to_change": "Owner name to change", + "booking_reassigned_to_host": "Booking reassigned to {{host}}", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/features/ee/round-robin/roundRobinReassignment.ts b/packages/features/ee/round-robin/roundRobinReassignment.ts index a6f7153ec2..063e52f3aa 100644 --- a/packages/features/ee/round-robin/roundRobinReassignment.ts +++ b/packages/features/ee/round-robin/roundRobinReassignment.ts @@ -519,6 +519,15 @@ export const roundRobinReassignment = async ({ hideBranding: !!eventType?.owner?.hideBranding, }); } + + return { + bookingId, + reassignedTo: { + id: reassignedRRHost.id, + name: reassignedRRHost.name, + email: reassignedRRHost.email, + }, + }; }; export default roundRobinReassignment; diff --git a/packages/trpc/server/routers/viewer/teams/roundRobin/roundRobinReassign.handler.ts b/packages/trpc/server/routers/viewer/teams/roundRobin/roundRobinReassign.handler.ts index ccf357af22..46b85fac15 100644 --- a/packages/trpc/server/routers/viewer/teams/roundRobin/roundRobinReassign.handler.ts +++ b/packages/trpc/server/routers/viewer/teams/roundRobin/roundRobinReassign.handler.ts @@ -23,7 +23,7 @@ export const roundRobinReassignHandler = async ({ ctx, input }: RoundRobinReassi throw new TRPCError({ code: "FORBIDDEN", message: "You do not have permission" }); } - await roundRobinReassignment({ bookingId, orgId: ctx.user.organizationId }); + return await roundRobinReassignment({ bookingId, orgId: ctx.user.organizationId }); }; export default roundRobinReassignHandler;