view_mail.js: fixed handling of references field
authorArt Cancro <ajc@citadel.org>
Wed, 6 Dec 2023 21:20:40 +0000 (16:20 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 6 Dec 2023 21:20:40 +0000 (16:20 -0500)
webcit-ng/static/js/view_mail.js

index 0641bace48b7bc5df3c7f611d738d2783e4a5467..5179973e809b15cfb71e7add50fb1351d6071f2c 100644 (file)
@@ -153,7 +153,7 @@ function mail_render_one(msgnum, msg, target_div, include_controls) {
                        + "<span class=\"ctdl-msg-header-buttons\">"            // begin buttons on right side
                
                        + "<span class=\"ctdl-msg-button\">"                    // Reply
-                       + "<a href=\"javascript:mail_compose(true,'"+msg.wefw+"','"+msgnum+"', reply_addr(msg), [], 'Re: '+msg.subj);\">"
+                       + `<a href="javascript:mail_compose(true, msg.wefw, ${msgnum}, reply_addr(msg), [], 'Re: ${subject}');">`
                        + "<i class=\"fa fa-reply\"></i> " 
                        + _("Reply")
                        + "</a></span>"
@@ -164,8 +164,8 @@ function mail_render_one(msgnum, msg, target_div, include_controls) {
                        + _("ReplyAll")
                        + "</a></span>"
                
-                       + "<span class=\"ctdl-msg-button\">"                    // Forward
-                       + "<a href=\"javascript:mail_compose(true,'"+msg.wefw+"','"+msgnum+"', '', '', 'Fwd: '+msg.subj);\">"
+                       + "<span class=\"ctdl-msg-button\">"                    // Forward FIXME
+                       + "<a>"
                        + "<i class=\"fa fa-mail-forward\"></i> " 
                        + _("Forward")
                        + "</a></span>";
@@ -457,7 +457,6 @@ function recipient_array_to_string(recps_arr) {
                // now convert it to a string
                returned_string = "";
                for (i=0; i<recps_arr.length; ++i) {
-                       console.log("to #" + i + ": " + recps_arr[i]);
                        if (i > 0) {
                                returned_string += ", ";
                        }
@@ -483,15 +482,6 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec
 
        let is_reply = 0;
 
-       console.log("");
-       console.log("mail_compose");
-       console.log("is_quoted: " + is_quoted);
-       console.log("references: " + references);
-       console.log("quoted_msgnum: " + quoted_msgnum);
-       console.log("m_to: " + m_to);
-       console.log("m_cc: " + m_cc);
-       console.log("m_subject: " + m_subject);
-
        // m_to will be an array of zero or more recipients for the To: field.  Convert it to a string.
        m_to_str = recipient_array_to_string(m_to);
 
@@ -503,11 +493,11 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec
        // Make the "Write mail" button disappear.  We're already there!
        document.getElementById("ctdl-newmsg-button").style.display = "none";
 
-       // Now display the screen.  (Yes, I combined regular strings + template literals.  I just learned template literals.  Converting to all template literals would be fine.)
+       // Now display the screen.  (Yes, I combined regular strings + template literals.
+       // I just learned template literals.  Converting the whole thing to template literals would be fine.)
        compose_screen =
                // Hidden values that we are storing right here in the document tree for later
-                 "<input id=\"ctdl_mc_is_quoted\" style=\"display:none\" value=\"" + is_quoted + "\"></input>"
-               + "<input id=\"ctdl_mc_references\" style=\"display:none\" value=\"" + references + "\"></input>"
+                 "<div id=\"ctdl-mc-references\" style=\"display:none\">" + references + "</div>"
 
                // Header fields, the composition window, and the button bar are arranged using a Grid layout.
                + "<div id=\"ctdl-compose-mail\" class=\"ctdl-compose-mail\">"
@@ -607,7 +597,7 @@ function mail_send_message() {
        deactivate_uploads();
        let url = "/ctdl/r/" + escapeHTMLURI(current_room)
                + "/dummy_name_for_new_mail"
-               + "?wefw="      + msm_field("ctdl_mc_references", "!")                          // references (if present)
+               + "?wefw="      + msm_field("ctdl-mc-references", "!")                          // references (if present)
                + "&subj="      + msm_field("ctdl-compose-subject-field", " ")                  // subject (if present)
                + "&mailto="    + msm_field("ctdl-compose-to-field", ",")                       // To: (required)
                + "&mailcc="    + msm_field("ctdl-compose-cc-field", ",")                       // Cc: (if present)