mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08: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
|
||||
* @param {jCard} json
|
||||
|
|
|
@ -137,12 +137,24 @@ export class ContactsPopupView extends AbstractViewPopup {
|
|||
recipients = {to:null,cc:null,bcc:null};
|
||||
|
||||
this.contactsCheckedOrSelected().forEach(oContact => {
|
||||
const data = oContact?.getNameAndEmailHelper();
|
||||
if (data) {
|
||||
data[1].forEach(address => {
|
||||
let email = new EmailModel(address, data[0]);
|
||||
if (oContact) {
|
||||
let name = (oContact.givenName() + ' ' + oContact.surName()).trim(),
|
||||
email,
|
||||
addresses = oContact.email();
|
||||
if (!oContact.sendToAll()) {
|
||||
addresses = addresses.slice(0,1);
|
||||
}
|
||||
addresses.forEach(address => {
|
||||
email = new EmailModel(address, name);
|
||||
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…
Reference in a new issue