emailArrayToStringLineHelper() filter addresses without email address

and simplify ComposeType handling
This commit is contained in:
the-djmaze 2023-02-13 19:19:00 +01:00
parent 974acaab90
commit d898178985

View file

@ -67,7 +67,7 @@ const
* @returns {string} * @returns {string}
*/ */
emailArrayToStringLineHelper = (aList, bFriendly) => emailArrayToStringLineHelper = (aList, bFriendly) =>
aList.map(item => item.toLine(bFriendly)).join(', '), aList.filter(item => item.email).map(item => item.toLine(bFriendly)).join(', '),
reloadDraftFolder = () => { reloadDraftFolder = () => {
const draftsFolder = FolderUserStore.draftsFolder(); const draftsFolder = FolderUserStore.draftsFolder();
@ -200,10 +200,6 @@ export class ComposePopupView extends AbstractViewPopup {
}; };
this.oEditor = null; this.oEditor = null;
this.aDraftInfo = null;
this.sInReplyTo = '';
this.bFromDraft = false;
this.sReferences = '';
this.sLastFocusedField = 'to'; this.sLastFocusedField = 'to';
@ -849,33 +845,17 @@ export class ComposePopupView extends AbstractViewPopup {
break; break;
case ComposeType.Draft: case ComposeType.Draft:
this.to(emailArrayToStringLineHelper(message.to));
this.cc(emailArrayToStringLineHelper(message.cc));
this.bcc(emailArrayToStringLineHelper(message.bcc));
this.replyTo(emailArrayToStringLineHelper(message.replyTo));
this.bFromDraft = true; this.bFromDraft = true;
this.draftsFolder(message.folder); this.draftsFolder(message.folder);
this.draftUid(message.uid); this.draftUid(message.uid);
// fallthrough
this.subject(sSubject);
this.prepareMessageAttachments(message, msgComposeType);
this.aDraftInfo = 3 === arrayLength(aDraftInfo) ? aDraftInfo : null;
this.sInReplyTo = message.inReplyTo;
this.sReferences = message.references;
break;
case ComposeType.EditAsNew: case ComposeType.EditAsNew:
this.to(emailArrayToStringLineHelper(message.to)); this.to(emailArrayToStringLineHelper(message.to));
this.cc(emailArrayToStringLineHelper(message.cc)); this.cc(emailArrayToStringLineHelper(message.cc));
this.bcc(emailArrayToStringLineHelper(message.bcc)); this.bcc(emailArrayToStringLineHelper(message.bcc));
this.replyTo(emailArrayToStringLineHelper(message.replyTo)); this.replyTo(emailArrayToStringLineHelper(message.replyTo));
this.subject(sSubject); this.subject(sSubject);
this.prepareMessageAttachments(message, msgComposeType); this.prepareMessageAttachments(message, msgComposeType);
this.aDraftInfo = 3 === arrayLength(aDraftInfo) ? aDraftInfo : null; this.aDraftInfo = 3 === arrayLength(aDraftInfo) ? aDraftInfo : null;
this.sInReplyTo = message.inReplyTo; this.sInReplyTo = message.inReplyTo;
this.sReferences = message.references; this.sReferences = message.references;