Merge pull request #28775 from overleaf/rh-dedupe-share-modal

Deduplicate emails when pasted in share modal

GitOrigin-RevId: 6c66b51fdbcc5ea3a24ea54523b5a47036fb3fb1
This commit is contained in:
roo hutton
2025-10-10 10:18:24 +01:00
committed by Copybot
parent 7aa66b260c
commit 26033aa76a

View File

@@ -237,12 +237,18 @@ export default function SelectCollaborators({
const emails = data
.split(/[\r\n,; ]+/)
.filter(item => item.includes('@'))
.map(email => email.replace(matchAllSpaces, ''))
if (emails.length) {
// pasted comma-separated email addresses
event.preventDefault()
for (const email of emails) {
// dedupe emails in pasted content and previously-entered items
const uniqueEmails = [...new Set(emails)].filter(
email => !selectedEmails.includes(email)
)
for (const email of uniqueEmails) {
addNewItem(email)
}
}