From 69892313dae58d0b58e2d7750ef0a50098ea4875 Mon Sep 17 00:00:00 2001 From: Douglas Fabris Date: Tue, 3 Dec 2024 18:51:09 -0300 Subject: [PATCH] fix: Export messages additional emails not being validated (#34092) Co-authored-by: gabriellsh <40830821+gabriellsh@users.noreply.github.com> --- .changeset/selfish-fishes-move.md | 5 +++++ .../room/contextualBar/ExportMessages/MailExportForm.tsx | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .changeset/selfish-fishes-move.md diff --git a/.changeset/selfish-fishes-move.md b/.changeset/selfish-fishes-move.md new file mode 100644 index 000000000000..a227695cea89 --- /dev/null +++ b/.changeset/selfish-fishes-move.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +fixes mail export form "To additional emails" field validation diff --git a/apps/meteor/client/views/room/contextualBar/ExportMessages/MailExportForm.tsx b/apps/meteor/client/views/room/contextualBar/ExportMessages/MailExportForm.tsx index c7a3276ac8e1..b6f0e4b88bf2 100644 --- a/apps/meteor/client/views/room/contextualBar/ExportMessages/MailExportForm.tsx +++ b/apps/meteor/client/views/room/contextualBar/ExportMessages/MailExportForm.tsx @@ -155,11 +155,8 @@ const MailExportForm = ({ formId, rid, onCancel, exportOptions }: MailExportForm rules={{ validate: { validateEmail: (additionalEmails) => { - if (additionalEmails === '') { - return undefined; - } - - if (additionalEmails !== '' && validateEmail(additionalEmails)) { + const emails = additionalEmails?.split(',').map((email) => email.trim()); + if (Array.isArray(emails) && emails.every((email) => validateEmail(email.trim()))) { return undefined; }