Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 17833: Do not merge contacts (first commit) #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

azadi
Copy link
Member

@azadi azadi commented Feb 23, 2016

Let's discuss disabling contacts merge. There are two ways of doing this, I am starting with the most recently discussed.

1). Return early and disable all contact merges, including ones to different tags (this commit).
2). Disable only the contact merge but allow contact tag merges.

I am OK with both but I am starting with 1)

@arlolra
Copy link
Member

arlolra commented Feb 23, 2016

This seems like it will handle the UI side of the merge well, but we also need an assertion that merges aren't sneaking in from other code paths.

@azadi
Copy link
Member Author

azadi commented Feb 24, 2016

OK, I had another look (and by that I meant that I did a grep and looked at the code):

$ rgrep -C2 mergeContact 
im/content/buddy.xml-         if (dt.types.contains("application/x-ib-contact")) {
im/content/buddy.xml-           let id = dt.getData("application/x-ib-contact");
im/content/buddy.xml:           contact.mergeContact(Services.contacts.getContactById(id));
im/content/buddy.xml-         }
im/content/buddy.xml-         else if (dt.types.contains("application/x-ib-buddy")) {
--
im/content/contact.xml-         if (dt.types.contains("application/x-ib-contact")) {
im/content/contact.xml-           let id = dt.getData("application/x-ib-contact");
im/content/contact.xml:           this.contact.mergeContact(Services.contacts.getContactById(id));
im/content/contact.xml-         }
im/content/contact.xml-         else if (dt.types.contains("application/x-ib-buddy")) {
--
chat/components/src/imContacts.js-               this._buddies.every(function(b) b._empty),
chat/components/src/imContacts.js-
chat/components/src/imContacts.js:  mergeContact: function(aContact) {
chat/components/src/imContacts.js-    // Avoid merging the contact with itself or merging into an
chat/components/src/imContacts.js-    // already removed contact.
--
chat/components/public/imIContactsService.idl-  // Move all the buddies of aContact into the current contact,
chat/components/public/imIContactsService.idl-  // and copy all its tags.
chat/components/public/imIContactsService.idl:  void mergeContact(in imIContact aContact);
chat/components/public/imIContactsService.idl-
chat/components/public/imIContactsService.idl-  // Change the position of aBuddy in the current contact.

So mergeContact is called both in the case of merging a buddy or a contact and since that does nothing, the drag and drop is rendered useless. Is there anything else you would like me to check? I personally feel we are OK with this one.

@arlolra
Copy link
Member

arlolra commented Feb 25, 2016

You need to read the docs in the interface

/*
 * An imIContact represents a person, e.g. our friend Alice. This person might
 * have multiple means of contacting them.
 *
 * Remember that an imIContact can have multiple buddies (imIBuddy instances),
 * each imIBuddy can have multiple account-buddies (prplIAccountBuddy instances)
 * referencing it. To be explicit, the difference is that an imIBuddy represents
 * a contact's account on a network, while a prplIAccountBuddy represents the
 * link between your account and your contact's account.
 *
 * Each of these implement imIStatusInfo: imIContact and imIBuddy should merge
 * the status info based on the information available in their instances of
 * imIBuddy and prplIAccountBuddy, respectively.
 */

Which means, you also need to handle adoptBuddy.

And you should assert that this._buddies.length === 1 in Contact.

ps. try hg grep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants