Skip to content

Commit

Permalink
chore: Call api only once when sharing a message (#30656)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriellsh authored and lmauromb committed Oct 26, 2023
1 parent 5bf9ef7 commit ba06879
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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') });
Expand Down

0 comments on commit ba06879

Please sign in to comment.