From 356a7b107536369cefc3cd6413e3e2ee75b04c9d Mon Sep 17 00:00:00 2001 From: gabriellsh <40830821+gabriellsh@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:29:08 -0300 Subject: [PATCH] chore: Call api only once when sharing a message (#30656) --- .../ForwardMessageModal/ForwardMessageModal.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/meteor/client/views/room/modals/ForwardMessageModal/ForwardMessageModal.tsx b/apps/meteor/client/views/room/modals/ForwardMessageModal/ForwardMessageModal.tsx index d249d7137728..c70436982b2e 100644 --- a/apps/meteor/client/views/room/modals/ForwardMessageModal/ForwardMessageModal.tsx +++ b/apps/meteor/client/views/room/modals/ForwardMessageModal/ForwardMessageModal.tsx @@ -37,17 +37,12 @@ const ForwardMessageModal = ({ onClose, permalink, message }: ForwardMessageProp mutationFn: async () => { const optionalMessage = ''; const curMsg = await prependReplies(optionalMessage, [message]); + const sendPayload = { + roomId: rooms, + text: curMsg, + }; - return Promise.all( - rooms.map(async (roomId) => { - const sendPayload = { - roomId, - text: curMsg, - }; - - await sendMessage(sendPayload); - }), - ); + return sendMessage(sendPayload); }, onSuccess: () => { dispatchToastMessage({ type: 'success', message: t('Message_has_been_forwarded') });