Cleanup Email.toLine()

This commit is contained in:
the-djmaze 2022-03-30 10:26:00 +02:00
parent 2af5257e10
commit 7585ac450e
3 changed files with 4 additions and 4 deletions

View file

@ -148,7 +148,7 @@ export class EmailAddressesComponent {
hook = (v && [',', ';', '\n'].includes(v.slice(-1))) ? EmailModel.splitEmailLine(val) : null,
values = (hook || [val]).map(value => EmailModel.parseEmailLine(value))
.flat(Infinity)
.map(item => (item.toLine ? [item.toLine(false), item] : [item, null]));
.map(item => (item.toLine ? [item.toLine(), item] : [item, null]));
if (values.length) {
values.forEach(a => {

View file

@ -388,7 +388,7 @@ export class EmailModel extends AbstractModel {
exists = true;
}
result.push(address ? address.toLine(false) : item.name);
result.push(address ? address.toLine() : item.name);
});
return exists ? result : null;

View file

@ -693,7 +693,7 @@ export class ComposePopupView extends AbstractViewPopup {
(iError, data) => {
if (!iError && isArray(data.Result)) {
fResponse(
data.Result.map(item => (item && item[0] ? (new EmailModel(item[0], item[1])).toLine(false) : null))
data.Result.map(item => (item && item[0] ? (new EmailModel(item[0], item[1])).toLine() : null))
.filter(v => v)
);
} else if (Notification.RequestAborted !== iError) {
@ -870,7 +870,7 @@ export class ComposePopupView extends AbstractViewPopup {
addEmailsTo(fKoValue, emails) {
if (arrayLength(emails)) {
const value = fKoValue().trim(),
values = emails.map(item => item ? item.toLine(false) : null)
values = emails.map(item => item ? item.toLine() : null)
.validUnique();
fKoValue(value + (value ? ', ' : '') + values.join(', ').trim());