Skip to content

Commit

Permalink
[Feature] nextcloud#9298 : Paste or copy several e-mail addresses int…
Browse files Browse the repository at this point in the history
…o address fields at once

Signed-off-by: Andrii Rublov <airublev@outlook.com>
  • Loading branch information
Andrii Rublov authored and arublov committed Feb 16, 2024
1 parent 447a099 commit 490618f
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/components/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1217,13 +1217,25 @@ export default {
this.onNewAddr(option, this.selectBcc)
},
onNewAddr(option, list) {
if (list.some((recipient) => recipient.email === option.email)) {
return
}
const recipient = { ...option }
this.newRecipients.push(recipient)
list.push(recipient)
this.saveDraftDebounced()
//@todo condition if it is not a contact
const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
const delimiterRegex = /;|,/
const addresses = option.email.trim().split(delimiterRegex).filter(email => emailRegex.test(email))
addresses.forEach(email => {
if (list.some((recipient) => recipient.email === email)) {
return
}
const t = {label: email, email: email}
const recipient = { ...t }
this.newRecipients.push(recipient)
list.push(recipient)
this.saveDraftDebounced()
});
},
async onSend(_, force = false) {
if (this.encrypt) {
Expand Down

0 comments on commit 490618f

Please sign in to comment.