Closed Bug 1037003 Opened 10 years ago Closed 7 years ago

[Contacts][Haida] Merging contacts doesn't work

Categories

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

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mbudzynski, Assigned: mbudzynski)

References

Details

      No description provided.
Steps to reproduce on WIP branch for Bug 1022646 (https://github.com/michalbe/gaia/tree/Bug946750-form)

* Create a contact with name & phone number
* Create another one with the same phone number
* Nothing happen
For the record, this is how merging works on master: 

- we click 'done' in the form view to save contact.
- saveContact function for form.js is called
- inside the function we create a contact object (when creating) or use currentContact (when editing) and update it with new data
- we create custom callbacks for two merge scenarios - 'onmatch' & 'onmismatch' by binding created (or updated) contact in cookMatchingCallbacks function
- we call doMatch function that lazyloads needed js and run contacts.Matcher, and passing there callbacks we created before
- when we have at leastone match (other scenario works so we don't care) 'onmatch' callback is called, with matches passed as parameter
- beginning of the callback is calling .extServices.showDuplicateContacts, what set's and source of the 'extensionFrame' to 'matching_contacts.html'
- the we set a mergeHandler listener
- when extensionFrame will be loaded with matching_contacts.html, it loads contacts_matching_controller.js file (included in html)
- onlocalized event fires so the start() funciton of the matching controller is fired with argument "window.location.search.substring('contactId'.length + 2)"
- inside the start function we add a listener for post messages and set 'duplicateContactsHandler' as it's handler
- after this, we sent a duplicate_contacts_loaded event to the parent window
- then show the curtain
- and set cancel listener on the curtain
- when form view receives 'duplicate_contacts_loaded' message, it creates list of duplicate contacts (inside this cooked callbacks) and send 'show_duplicate_contacts' message
- when service extension receives the message, it passes it down to extensionFrame.contentWindow, where we have 'matching_contacts.html' as a source
- when contacts_matching_controller.js receives the message it fires proper handler (duplicateContactsHandler) and render the list of contacts (showUI())
- this function lazyloads needed files and calls sendReadyEvent function, which sents a 'ready' message to the parent in Curtain.hide callback (from /shared/pages/import/js/curtain.js)
After a brainstorm meeting today morning with Francisco & Jose Manuel we prepared a patch together with Francisco [1]. It doesn't work sometimes (for me is most of the times), so there is probably a race condition somewhere. Investigating it now.

[1] https://github.com/michalbe/gaia/commit/b8459152cf4ec713d6bfcdb7a06e3bb2d289fab5
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.