Bug 955003 - Contacts added directly to "Other Contacts" don't show until collapsed/expanded, r=florian.
authoraleth <aleth@instantbird.org>
Sat, 19 Oct 2013 19:40:42 +0200
changeset 17312 03a1d87c844ec29708d1a2340283beba06a75997
parent 17311 fe1660b5139132dc358fc8184ab2522b2cd6070c
child 17313 43618a31ce1b6bff61678f97f9e1227bb1c4d4f7
push id1151
push userbugzilla@standard8.plus.com
push dateMon, 03 Feb 2014 22:50:32 +0000
treeherdercomm-aurora@267d8e9143d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs955003
Bug 955003 - Contacts added directly to "Other Contacts" don't show until collapsed/expanded, r=florian.
chat/components/src/imContacts.js
--- a/chat/components/src/imContacts.js
+++ b/chat/components/src/imContacts.js
@@ -280,17 +280,17 @@ var otherContactsTag = {
   _hideTag: function(aTag) {
     for each (let contact in aTag.getContacts())
       if (!(contact.id in this._contacts) &&
           contact.getTags().every(function(t) t.id in this._hiddenTags, this))
         this._addContact(contact);
   },
   observe: function(aSubject, aTopic, aData) {
     aSubject.QueryInterface(Ci.imIContact);
-    if (aTopic == "contact-tag-removed") {
+    if (aTopic == "contact-tag-removed" || aTopic == "contact-added") {
       if (!(aSubject.id in this._contacts) &&
           !(parseInt(aData) in this._hiddenTags) &&
           aSubject.getTags().every(function(t) t.id in this._hiddenTags, this))
         this._addContact(aSubject);
     }
     else if (aSubject.id in this._contacts &&
              (aTopic == "contact-removed" ||
               (aTopic == "contact-tag-added" &&
@@ -319,37 +319,38 @@ var otherContactsTag = {
       }
     };
     this._contacts = {};
     this._contactsInitialized = true;
     for each (let tag in this._hiddenTags)
       this._hideTag(tag);
     Services.obs.addObserver(this, "contact-tag-added", false);
     Services.obs.addObserver(this, "contact-tag-removed", false);
+    Services.obs.addObserver(this, "contact-added", false);
     Services.obs.addObserver(this, "contact-removed", false);
   },
 
   // imITag implementation
   get id() -1,
   get name() "__others__",
   set name(aNewName) { throw Cr.NS_ERROR_NOT_AVAILABLE; },
   getContacts: function(aContactCount) {
     let contacts = [contact for each (contact in this._contacts)];
     if (aContactCount)
       aContactCount.value = contacts.length;
     return contacts;
   },
-  _addContact: function (aContact) {
+  _addContact: function(aContact) {
     this._contacts[aContact.id] = aContact;
     this.notifyObservers(aContact, "contact-moved-in");
     for each (let observer in ContactsById[aContact.id]._observers)
       observer.observe(this, "contact-moved-in", null);
     aContact.addObserver(this._observer);
   },
-  _removeContact: function (aContact) {
+  _removeContact: function(aContact) {
     delete this._contacts[aContact.id];
     aContact.removeObserver(this._observer);
     this.notifyObservers(aContact, "contact-moved-out");
     for each (let observer in ContactsById[aContact.id]._observers)
       observer.observe(this, "contact-moved-out", null);
   },
 
   addObserver: function(aObserver) {