Skip to content

Commit

Permalink
make sure to filter out invalid emails before sending the request
Browse files Browse the repository at this point in the history
  • Loading branch information
blackforestboi committed Jul 24, 2024
1 parent 4213d8b commit 7d4c46f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/custom-lists/ui/space-email-invites/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -159,7 +160,7 @@ export default class SpaceEmailInvitesLogic extends UILogic<State, Event> {
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
Expand Down

0 comments on commit 7d4c46f

Please sign in to comment.