Closed Bug 895149 Opened 11 years ago Closed 11 years ago

contacts app sorts case-sensitive while contacts API sorts case-insensitive

Categories

(Firefox OS Graveyard :: Gaia::Contacts, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bkelly, Assigned: bkelly)

Details

(Whiteboard: [ c= p=1 s=2013.07.26 ])

Attachments

(1 file)

While experimenting with various vcards exported from my addressbook I noticed some strange sorting behavior.  After importing I would see things like:

  AT&T Customer Service
  Adam Smith

Killing the app and relaunching would then result in:

  Adam Smith
  AT&T Customer Service

This appears to be due to the way the contacts API in gecko sorts compared to how the contacts app sorts.  When launching the app we use the gecko sorting method which does a toLowerCase() before comparison.  When importing we use the "contact updated" method which inserts the contact into the existing list by doing comparisons in the app.  In this case, however, the case is not adjusted so the sort order is case-sensitive.

I have a fix ready to make the app perform case-insensitive comparisons.  I still need to update the tests, however.
This fixes the app insertion sort to be case insensitive like the gecko ContactsAPI sorting.

I also added a test to expose the problem.  Note, however, that depending on your LANG environment variable it may pass without this change anyway.  You'll need to run your unit test firefox with LANG=en_US to observe the failure.  See bug 895419 for more details.
Attachment #777793 - Flags: review?(francisco.jordano)
Attachment #777793 - Attachment mime type: text/plain → text/html
Comment on attachment 777793 [details]
Pull request at https://github.com/mozilla-b2g/gaia/pull/11051

Perfect, thanks Ben!
Attachment #777793 - Flags: review?(francisco.jordano)
Attachment #777793 - Flags: review+
Attachment #777793 - Flags: feedback?(kaze)
Thanks for the review!  I had actually briefly spoke with kaze on IRC earlier today about some of the issues in this bug, so I went ahead with the merge.  I can backout if there are any concerns.

  https://github.com/mozilla-b2g/gaia/commit/b9265f92887f5dfad190d62941b7e533304815c4
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Cool, I was just about to suggest to talk to kaze as couldn't figure out an scenario where this fix couldn't work.

Thanks again Ben!
Comment on attachment 777793 [details]
Pull request at https://github.com/mozilla-b2g/gaia/pull/11051

Post-mortem f+
Attachment #777793 - Flags: feedback?(kaze) → feedback+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: