Improved email address parsing and handling

This commit is contained in:
the-djmaze 2023-02-13 16:15:26 +01:00
parent e8c93a1d0c
commit 33653eae81
7 changed files with 165 additions and 238 deletions

View file

@ -37,7 +37,7 @@ import { MessagelistUserStore } from 'Stores/User/Messagelist';
import Remote from 'Remote/User/Fetch';
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
import { EmailModel } from 'Model/Email';
import { EmailModel, addressparser } from 'Model/Email';
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
@ -59,12 +59,7 @@ const
base64_encode = text => btoa(unescape(encodeURIComponent(text))).match(/.{1,76}/g).join('\r\n'),
email = new EmailModel(),
getEmail = value => {
email.clear();
email.parse(value.trim());
return email.email || false;
},
getEmail = value => addressparser(value)[0]?.address || false,
/**
* @param {Array} aList