From 7d4c46fd1b0628444d0167ad0250cd8fa19a2416 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 24 Jul 2024 17:32:28 +0200 Subject: [PATCH] make sure to filter out invalid emails before sending the request --- src/custom-lists/ui/space-email-invites/logic.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/custom-lists/ui/space-email-invites/logic.ts b/src/custom-lists/ui/space-email-invites/logic.ts index 7094190333..4de0510e11 100644 --- a/src/custom-lists/ui/space-email-invites/logic.ts +++ b/src/custom-lists/ui/space-email-invites/logic.ts @@ -13,6 +13,7 @@ import { import type { AutoPk } from '@worldbrain/memex-common/lib/storage/types' import type { UnifiedList } from 'src/annotations/cache/types' import type { ContentSharingInterface } from 'src/content-sharing/background/types' +import { isValidEmail } from '@worldbrain/memex-common/lib/utils/email-validation' export interface Dependencies { listData: UnifiedList @@ -159,7 +160,7 @@ export default class SpaceEmailInvitesLogic extends UILogic { const emails = event.state.emailInviteInputValue .split(',') .map((email) => email.trim()) - .filter((email) => email !== '') // Remove any empty strings + .filter((email) => !isValidEmail(email)) // Filter out invalid emails const roleID = event.state.emailInviteInputRole let prevInviteCount = event.state.emailInvites.allIds.length