mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 15:37:03 +03:00
Merge getNameAndEmailHelper() into newMessageCommand()
This commit is contained in:
parent
08257f47cb
commit
c1c851c238
2 changed files with 16 additions and 27 deletions
|
|
@ -135,29 +135,6 @@ export class ContactModel extends AbstractModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Array|null}
|
|
||||||
*/
|
|
||||||
getNameAndEmailHelper() {
|
|
||||||
let name = (this.givenName() + ' ' + this.surName()).trim(),
|
|
||||||
email = [],
|
|
||||||
addresses = this.email();
|
|
||||||
|
|
||||||
if (this.sendToAll()) {
|
|
||||||
addresses.forEach(key => email.push(key.value()));
|
|
||||||
} else if (addresses.length) {
|
|
||||||
email.push(addresses[0].value());
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// this.jCard.getOne('fn')?.notEmpty() ||
|
|
||||||
this.jCard.parseFullName({set:true});
|
|
||||||
// let name = this.jCard.getOne('nickname'),
|
|
||||||
let name = this.jCard.getOne('fn'),
|
|
||||||
email = [this.jCard.getOne('email')];
|
|
||||||
*/
|
|
||||||
return email.length ? [name, email] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {jCard} json
|
* @param {jCard} json
|
||||||
|
|
|
||||||
|
|
@ -137,12 +137,24 @@ export class ContactsPopupView extends AbstractViewPopup {
|
||||||
recipients = {to:null,cc:null,bcc:null};
|
recipients = {to:null,cc:null,bcc:null};
|
||||||
|
|
||||||
this.contactsCheckedOrSelected().forEach(oContact => {
|
this.contactsCheckedOrSelected().forEach(oContact => {
|
||||||
const data = oContact?.getNameAndEmailHelper();
|
if (oContact) {
|
||||||
if (data) {
|
let name = (oContact.givenName() + ' ' + oContact.surName()).trim(),
|
||||||
data[1].forEach(address => {
|
email,
|
||||||
let email = new EmailModel(address, data[0]);
|
addresses = oContact.email();
|
||||||
|
if (!oContact.sendToAll()) {
|
||||||
|
addresses = addresses.slice(0,1);
|
||||||
|
}
|
||||||
|
addresses.forEach(address => {
|
||||||
|
email = new EmailModel(address, name);
|
||||||
email.valid() && aE.push(email);
|
email.valid() && aE.push(email);
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
|
// oContact.jCard.getOne('fn')?.notEmpty() ||
|
||||||
|
oContact.jCard.parseFullName({set:true});
|
||||||
|
// let name = oContact.jCard.getOne('nickname'),
|
||||||
|
let name = oContact.jCard.getOne('fn'),
|
||||||
|
email = [oContact.jCard.getOne('email')];
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue