diff --git a/src/converse-rosterview.js b/src/converse-rosterview.js index 08bd46c75..ed045ec43 100644 --- a/src/converse-rosterview.js +++ b/src/converse-rosterview.js @@ -286,11 +286,6 @@ onContactAdd: function (contact) { this.addRosterContact(contact).update(); - if (!contact.get('vcard_updated')) { - // This will update the vcard, which triggers a change - // request which will rerender the roster contact. - converse.getVCard(contact.get('jid')); - } }, onContactChange: function (contact) { diff --git a/src/converse-vcard.js b/src/converse-vcard.js index e4c1e70b8..bb40eec35 100644 --- a/src/converse-vcard.js +++ b/src/converse-vcard.js @@ -158,6 +158,18 @@ }; converse.on('chatBoxInitialized', updateVCardForChatBox); + + var onContactAdd = function (contact) { + if (!contact.get('vcard_updated')) { + // This will update the vcard, which triggers a change + // request which will rerender the roster contact. + converse.getVCard(contact.get('jid')); + } + }; + converse.on('initialized', function () { + converse.roster.on("add", onContactAdd); + }); + var fetchOwnVCard = function () { if (converse.xmppstatus.get('fullname') === undefined) { converse.getVCard(