Improved #1286 to be in line with all code

This commit is contained in:
the-djmaze 2023-12-11 11:38:38 +01:00
parent 65d469f71a
commit 08257f47cb
42 changed files with 98 additions and 65 deletions

View file

@ -140,24 +140,22 @@ export class ContactModel extends AbstractModel {
*/
getNameAndEmailHelper() {
let name = (this.givenName() + ' ' + this.surName()).trim(),
email;
email = [],
addresses = this.email();
if (this.sendToAll()) {
email = [];
this.email().forEach(function (key){
email.push(key?.value())
});
} else {
email = this.email()[0]?.value();
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');
email = [this.jCard.getOne('email')];
*/
return email ? [email, name] : null;
return email.length ? [name, email] : null;
}
/**
@ -332,10 +330,6 @@ export class ContactModel extends AbstractModel {
+ (this.focused() ? ' focused' : '');
}
sendToAllDefaultValue() {
return (this.sendToAll() ? ' checked' : '');
}
sendToAllDisplayStatus() {
return this.email.length > 1
}

View file

@ -145,7 +145,7 @@
margin: 0;
overflow: auto;
span {
:not(.e-checkbox) > span {
height: 20px;
line-height: 20px;
display: none;
@ -170,11 +170,6 @@
width: 70vw;
max-width: 400px;
}
#send-to-all > input[type="checkbox"] {
margin-left: 2px;
margin-right: 10px;
}
}
.read-only-sign {

View file

@ -1381,13 +1381,13 @@ export class ComposePopupView extends AbstractViewPopup {
};
}
});
/*
let sToAddress = this.to();
if (/".*" <.*,.*>/g.test(sToAddress)) {
sToAddress = sToAddress.match(/<.*>/g)[0].replace(/[<>]/g, '');
}
*/
const
identity = this.currentIdentity(),
params = {
@ -1396,7 +1396,7 @@ export class ComposePopupView extends AbstractViewPopup {
messageUid: this.draftUid(),
saveFolder: sSaveFolder,
from: this.from(),
to: sToAddress,
to: this.to(),
cc: this.cc(),
bcc: this.bcc(),
replyTo: this.replyTo(),

View file

@ -137,9 +137,13 @@ export class ContactsPopupView extends AbstractViewPopup {
recipients = {to:null,cc:null,bcc:null};
this.contactsCheckedOrSelected().forEach(oContact => {
const data = oContact?.getNameAndEmailHelper(),
email = data ? new EmailModel(data[0], data[1]) : null;
email?.valid() && aE.push(email);
const data = oContact?.getNameAndEmailHelper();
if (data) {
data[1].forEach(address => {
let email = new EmailModel(address, data[0]);
email.valid() && aE.push(email);
});
}
});
if (arrayLength(aE)) {