Bug 309057 - Port |Bug 240138 - Show just the name and not the email address in the message pane| to SeaMonkey; then bug 381555 and bug 243631; (Hv2) bug 243631; r=iann_bugzilla sr=neil aSM2.0a1=iann_bugzilla
authorSerge Gautherie <sgautherie.bz@free.fr>
Wed, 24 Sep 2008 00:33:58 +0200
changeset 409 dba6f5a634ec4811889485b1788928057c89773d
parent 408 afc9faafb312235189ba0e52b7af541bcd4b26b1
child 410 7f9f210762cdb0055c912d9e3cd4b19e111b1d44
push idunknown
push userunknown
push dateunknown
reviewersiann_bugzilla, neil
bugs309057, 240138, 381555, 243631
Bug 309057 - Port |Bug 240138 - Show just the name and not the email address in the message pane| to SeaMonkey; then bug 381555 and bug 243631; (Hv2) bug 243631; r=iann_bugzilla sr=neil aSM2.0a1=iann_bugzilla
mailnews/base/resources/content/msgHdrViewOverlay.js
--- a/mailnews/base/resources/content/msgHdrViewOverlay.js
+++ b/mailnews/base/resources/content/msgHdrViewOverlay.js
@@ -1033,31 +1033,31 @@ function updateEmailAddressNode(emailAdd
 
 // If the email address is found in any of the address books,
 // then consider this user a 'known' user and use the display name.
 function AddExtraAddressProcessing(emailAddress, addressNode)
 {
   if (!gShowCondensedEmailAddresses)
     return;
 
+  // Get the id of the mail-multi-emailHeaderField binding parent.
+  var parentElementId = addressNode.parentNode.parentNode.parentNode.id;
+  // Don't condense the address for the from and reply-to fields.
+  // Ids: "collapsedfromValue", "expandedfromBox", "expandedreply-toBox".
+  if (/^(collapsedfromValue|expanded(from|reply-to)Box)$/.test(parentElementId))
+    return;
+
   // TODO: Maybe do domain matches too (i.e. any email from someone in my
   // company should use the friendly display name).
 
-  const displayName = addressNode.getAttribute("displayName");
-  if (!(displayName && getCardForAddress(emailAddress)))
+  var card = getCardForAddress(emailAddress);
+  if (!(card && card.displayName))
     return;
 
-  // Get the id of the mail-multi-emailHeaderField binding parent.
-  var parentElementId = addressNode.parentNode.parentNode.parentNode.id;
-  // Don't condense the address for the from and reply-to fields.
-  if (parentElementId == "expandedfromBox" ||
-      parentElementId == "expandedreply-toBox")
-    return;
-
-  addressNode.setAttribute("label", displayName);
+  addressNode.setAttribute("label", card.displayName);
   addressNode.setAttribute("tooltiptext", emailAddress);
 }
 
 function fillEmailAddressPopup(emailAddressNode)
 {
   document.getElementById("emailAddressPlaceHolder")
           .setAttribute("label", emailAddressNode.getAttribute("emailAddress"));
 }