Bug 1362130 - enable Send button when mailinglist name gets quoted. r=jcranmer
authoraceman <acelists@atlas.sk>
Sat, 13 May 2017 11:36:00 +0200
changeset 28230 d5dd2b8171f8b8d66c1cb63a3010ccae0f87da44
parent 28229 3901093d4934f5c8915a56f39df2f9f419ac52ec
child 28231 b8d187a8af7e03716ec91c4bff5b2f73905b4051
push id1966
push userclokep@gmail.com
push dateMon, 12 Jun 2017 16:57:35 +0000
treeherdercomm-beta@32d9b8d10da1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1362130
Bug 1362130 - enable Send button when mailinglist name gets quoted. r=jcranmer
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5,16 +5,17 @@
 /**
  * Commands for the message composition window.
  */
 
 // Ensure the activity modules are loaded for this window.
 Components.utils.import("resource:///modules/activity/activityModules.js");
 Components.utils.import("resource:///modules/attachmentChecker.js");
 Components.utils.import("resource:///modules/cloudFileAccounts.js");
+Components.utils.import("resource:///modules/mimeParser.jsm");
 Components.utils.import("resource:///modules/errUtils.js");
 Components.utils.import("resource:///modules/folderUtils.jsm");
 Components.utils.import("resource:///modules/iteratorUtils.jsm");
 Components.utils.import("resource:///modules/mailServices.js");
 Components.utils.import("resource:///modules/MailUtils.js");
 Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
 Components.utils.import("resource://gre/modules/PluralForm.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
@@ -3194,20 +3195,24 @@ function updateSendLock()
   const mailTypes = [ "addr_to", "addr_cc", "addr_bcc" ];
 
   // Enable the send buttons if anything useable was entered into at least one
   // recipient field.
   for (let row = 1; row <= top.MAX_RECIPIENTS; row ++)
   {
     let popupValue = awGetPopupElement(row).value;
     let inputValue = awGetInputElement(row).value.trim();
+    let listNames = null;
     if ((mailTypes.includes(popupValue) &&
+         // a properly looking email address
         (isValidAddress(inputValue) ||
-         MailServices.ab.mailListNameExists(inputValue.replace(/ *<.*>/, "")))) ||
-        ((popupValue == "addr_newsgroups") && (inputValue != "")))
+         // a valid mailing list name in some or our addressbooks
+         ((listNames = MimeParser.parseHeaderField(inputValue, MimeParser.HEADER_ADDRESS)) &&
+          listNames.length > 0 && MailServices.ab.mailListNameExists(listNames[0].name))
+        )) || ((popupValue == "addr_newsgroups") && (inputValue != "")))
     {
       gSendLocked = false;
       break;
     }
   }
 }
 
 /**