← Back to team overview

desktop-packages team mailing list archive

[Bug 956618]

 

Comment on attachment 8556897
Patch v1

Review of attachment 8556897:
-----------------------------------------------------------------

::: mailnews/addrbook/src/nsAbAutoCompleteSearch.js
@@ +128,5 @@
>     * Gets the score of the (full) address, given the search input. We want
>     * results that match the beginning of a "word" in the result to score better
>     * than a result that matches only in the middle of the word.
>     *
> +   * @param aCard - The card whose score is being decided

lowercase t?

@@ +139,5 @@
> +
> +    // We will firstly check if the search term provided by the user
> +    // is the nick name for the card or at least in the beginning of it.
> +    let nick = aCard.getProperty("NickName", "");
> +    nick = nick.toLocaleLowerCase();

you can just put .toLocaleLowerCase() after getPropery above

@@ +140,5 @@
> +    // We will firstly check if the search term provided by the user
> +    // is the nick name for the card or at least in the beginning of it.
> +    let nick = aCard.getProperty("NickName", "");
> +    nick = nick.toLocaleLowerCase();
> +    aSearchString = aSearchString.toLocaleLowerCase();

remove the duplication of this below.

@@ +143,5 @@
> +    nick = nick.toLocaleLowerCase();
> +    aSearchString = aSearchString.toLocaleLowerCase();
> +    let nickIndex = nick.indexOf(aSearchString);
> +    if (nick == aSearchString || nickIndex == 0)
> +      return BEST;

You don't need the nick == aSearchString
But, this doesn't quite do what this bug requests. What is requested is that nick should act as a "super-best" match. so the score should be 1 better than if it matched in display name - as is they would be equal (BEST + 1)

Please also adjust the test for this. There should be one test where the
nick is the beginning of another persons name.

::: mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch6.js
@@ +139,5 @@
>      card.setProperty("PopularityIndex", element.popularityIndex);
>      card.firstName = element.firstName;
>      card.lastName = element.lastName;
> +    if (element.NickName)
> +      card.setProperty("NickName", element.NickName);

You don't need the if I think. All the other props are also just set to
undefined if not set. Also, please lowerCamelCase NickName

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to thunderbird in Ubuntu.
https://bugs.launchpad.net/bugs/956618

Title:
  Nickname not over-riding names in email address

Status in Mozilla Thunderbird Mail and News:
  Confirmed
Status in thunderbird package in Ubuntu:
  New

Bug description:
  From what I have read in the support forum the nickname should take
  priority in the search for an email address in the to: field. It does
  not appear to work any more.

  Example:

  One friend's address is Mark<Mark@xxxxxxxx>. The other is
  James<James.Mark@xxxxxxxx>. Both are in my address book with Mark
  entered as the nickname of Mark@xxxxxxxx  and James as nickname for
  James.Mark@xxxxxxxx.

  If I type james in the To: field I get james.mark as a first entry in
  the list of available addresses.

  If I type mark I get the same address again, when I would prefer the
  first optional address to be mark@xxxxxxxx

  Reason it is needed:
  I am trying to avoid sending emails meant for mark@xxxxxxxx to James.mark because I do not notice in time that I have defaulted to the first entry in the list of available addresses.

  ProblemType: Bug
  DistroRelease: Ubuntu 11.10
  Package: thunderbird 10.0.2+build1-0ubuntu0.11.10.1
  ProcVersionSignature: Ubuntu 3.0.0-16.29-generic-pae 3.0.20
  Uname: Linux 3.0.0-16-generic-pae i686
  ApportVersion: 1.23-0ubuntu4
  Architecture: i386
  BuildID: 20120216123548
  Date: Fri Mar 16 00:31:06 2012
  InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
  SourcePackage: thunderbird
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/thunderbird/+bug/956618/+subscriptions