mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +03:00
Cleanup Email.toLine()
This commit is contained in:
parent
2af5257e10
commit
7585ac450e
3 changed files with 4 additions and 4 deletions
|
|
@ -148,7 +148,7 @@ export class EmailAddressesComponent {
|
||||||
hook = (v && [',', ';', '\n'].includes(v.slice(-1))) ? EmailModel.splitEmailLine(val) : null,
|
hook = (v && [',', ';', '\n'].includes(v.slice(-1))) ? EmailModel.splitEmailLine(val) : null,
|
||||||
values = (hook || [val]).map(value => EmailModel.parseEmailLine(value))
|
values = (hook || [val]).map(value => EmailModel.parseEmailLine(value))
|
||||||
.flat(Infinity)
|
.flat(Infinity)
|
||||||
.map(item => (item.toLine ? [item.toLine(false), item] : [item, null]));
|
.map(item => (item.toLine ? [item.toLine(), item] : [item, null]));
|
||||||
|
|
||||||
if (values.length) {
|
if (values.length) {
|
||||||
values.forEach(a => {
|
values.forEach(a => {
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ export class EmailModel extends AbstractModel {
|
||||||
exists = true;
|
exists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push(address ? address.toLine(false) : item.name);
|
result.push(address ? address.toLine() : item.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
return exists ? result : null;
|
return exists ? result : null;
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
(iError, data) => {
|
(iError, data) => {
|
||||||
if (!iError && isArray(data.Result)) {
|
if (!iError && isArray(data.Result)) {
|
||||||
fResponse(
|
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)
|
.filter(v => v)
|
||||||
);
|
);
|
||||||
} else if (Notification.RequestAborted !== iError) {
|
} else if (Notification.RequestAborted !== iError) {
|
||||||
|
|
@ -870,7 +870,7 @@ export class ComposePopupView extends AbstractViewPopup {
|
||||||
addEmailsTo(fKoValue, emails) {
|
addEmailsTo(fKoValue, emails) {
|
||||||
if (arrayLength(emails)) {
|
if (arrayLength(emails)) {
|
||||||
const value = fKoValue().trim(),
|
const value = fKoValue().trim(),
|
||||||
values = emails.map(item => item ? item.toLine(false) : null)
|
values = emails.map(item => item ? item.toLine() : null)
|
||||||
.validUnique();
|
.validUnique();
|
||||||
|
|
||||||
fKoValue(value + (value ? ', ' : '') + values.join(', ').trim());
|
fKoValue(value + (value ? ', ' : '') + values.join(', ').trim());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue