Closed Bug 1249873 Opened 8 years ago Closed 8 years ago

Use makeMailboxObject to construct 'name <email>' format of sender in bug 1209565

Categories

(Thunderbird :: Message Reader UI, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 47.0

People

(Reporter: aceman, Assigned: aceman)

References

Details

Attachments

(1 file)

Sorry for looking at the patch in bug 1209565 after landing.
Is there a reason that the construction of the sender address display is hardcoded to:
+      return addresses[0].name ?
+             addresses[0].name + " <" + addresses[0].email + ">" :
+             addresses[0].email;
?

If not, please use makeMailboxObject().
It is used like as MailServices.headerParser.makeMailboxObject(name, email).toString()

There is also a helper function when you are in C++, see bug 318495 .

Please look around in the file mail/base/modules/displayNameUtils.js if more places could be converted.
Or if the place where this is used is performance-cricital, we can surely make a helper function that does not create an object like makeMailboxObject(), as we do not need the object itself, just the address string.
(In reply to :aceman from comment #0)
> Is there a reason that the construction of the sender address display is
> hardcoded to:

Ignorance ;-) Something similar was done a few lines above:
  // Make sure we have an unambiguous name if there are multiple identities
  if (MailServices.accounts.allIdentities.length > 1)
    displayName += " <" + identity.email + ">";

If you have a better solution, please submit it.
Attached patch patchSplinter Review
OK, this should do it. Can you try it on the testcases from bug 1209565? Thanks
Assignee: nobody → acelists
Status: NEW → ASSIGNED
Attachment #8721698 - Flags: review?(mozilla)
Oof, that's a mouthful of text ;-)

Any change needs to pass
mozmake SOLO_TEST=folder-display/test-summarization.js mozmill-one
mozmake SOLO_TEST=multiple-identities/test-display-names.js mozmill-one

That's the two I had to fix. I'll try it out right now; can you please manually run those tests.
Comment on attachment 8721698 [details] [diff] [review]
patch

Review of attachment 8721698 [details] [diff] [review]:
-----------------------------------------------------------------

I'm not sure I have review power here ;-)
Anyway, I looked at my manual case and ran the two Mozmill tests. All passed, so r+.
r=jorgk (all lower case).
Attachment #8721698 - Flags: review?(mozilla) → review+
(In reply to Jorg K (GMT+1) from comment #4)
> Oof, that's a mouthful of text ;-)

Yes, it may be longer, but the point is to only use a single function to format the address. In case we want to change the format in future.
https://hg.mozilla.org/comm-central/rev/e52fd32c6b6c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 47.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: