From: Art Cancro Date: Sun, 6 Nov 2022 22:59:48 +0000 (-0500) Subject: More logic for To: and Cc: in reply-all X-Git-Tag: v959~8 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=b88f8054b7d1d79577277f8fc5637e6d6d7d01e2;p=citadel.git More logic for To: and Cc: in reply-all --- diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 27a34d245..174178e0c 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -13,14 +13,20 @@ var RefreshMailboxInterval; // We store our refresh timer here // Render reply address for a message (FIXME we might want to figure out in-reply-to) function reply_addr(msg) { if (msg.locl) { - return(msg.from); + return([msg.from]); } else { - return(msg.from + " <" + msg.rfca + ">"); + return([msg.from + " <" + msg.rfca + ">"]); } } +// Render the To: recipients for a reply-all operation +function replyall_to(msg) { + return([...reply_addr(msg), ...msg.rcpt]); +} + + // Render a message into the mailbox view // (We want the message number and the message itself because we need to keep the msgnum for reply purposes) function mail_render_one(msgnum, msg, target_div, include_controls) { @@ -44,13 +50,13 @@ function mail_render_one(msgnum, msg, target_div, include_controls) { + "" // begin buttons on right side + "" // Reply (mail is always Quoted) - + "" + + "" + " " + _("Reply") + "" + "" // Reply-All (mail is always Quoted) - + "" + + "" + " " + _("ReplyAll") + ""; @@ -255,6 +261,38 @@ function render_mailbox_display() { // Compose a new mail message (called by the Reply button here, or by the dispatcher in views.js) function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subject) { + console.log("mail_compose()"); + + // m_to will be an array of zero or more recipients for the To: field. Convert it to a string. + if (m_to) { + m_to = Array.from(new Set(m_to)); // remove dupes + m_to_str = ""; + for (i=0; i 0) { + m_to_str += ", "; + } + m_to_str += m_to[i].replaceAll("<", "<").replaceAll(">", ">"); + } + } + else { + m_to_str = ""; + } + + // m_to will be an array of zero or more recipients for the Cc: field. Convert it to a string. + if (m_cc) { + m_cc = Array.from(new Set(m_cc)); // remove dupes + m_cc_str = ""; + for (i=0; i 0) { + m_cc_str += ", "; + } + m_cc_str += m_cc[i].replaceAll("<", "<").replaceAll(">", ">"); + } + } + else { + m_cc_str = ""; + } + quoted_div_name = randomString(); // Make the "Write mail" button disappear. We're already there! @@ -276,7 +314,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec // Visible To: field, plus a box to make the CC/BCC lines appear + "
" + _("To:") + "
" + "
" - + "
" + m_to + "
" + + "
" + m_to_str + "
" + "
" + _("CC:") + "/" + _("BCC:") + "
" @@ -284,7 +322,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec // CC/BCC + "
" + _("CC:") + "
" - + "
" + m_cc + "
" + + "
" + m_cc_str + "
" + "
" + _("BCC:") + "
" + "
"