ソースを参照

Bugfix. Contact's name got replaced with JID. updates #58

JC Brand 11 年 前
コミット
0369f11dc5
2 ファイル変更11 行追加2 行削除
  1. 8 0
      CHANGES.rst
  2. 3 2
      converse.js

+ 8 - 0
CHANGES.rst

@@ -9,11 +9,19 @@ Changelog
     HTML needed in your webpage for converse.js to work has been reduced to a
     single div: <div id="conversejs"></div>
 
+Features:
+~~~~~~~~~
+
 * Add a toolbar for single user chat [jcbrand]
 * Add support for OTR (off-the-record) encryption [jcbrand]
 * Add support for smileys [jcbrand]
 * Simplified boilerplate markup [jcbrand]
 * New configuration settings, ``xhr_custom_status_url`` and ``xhr_user_search_url`` [jcbrand]
+
+Bugfixes:
+~~~~~~~~~
+
+* #58 Contact's name gets replaced with their JID [jcbrand]
 * #81 Requesting contacts appear as pending contacts [jcbrand]
 
 0.6.6 (2013-10-16)

+ 3 - 2
converse.js

@@ -190,7 +190,7 @@
             converse.connection.vcard.get(
                 $.proxy(function (iq) {
                     // Successful callback
-                    $vcard = $(iq).find('vCard');
+                    var $vcard = $(iq).find('vCard');
                     var fullname = $vcard.find('FN').text(),
                         img = $vcard.find('BINVAL').text(),
                         img_type = $vcard.find('TYPE').text(),
@@ -198,8 +198,9 @@
                     if (jid) {
                         var rosteritem = converse.roster.get(jid);
                         if (rosteritem) {
+                            fullname = _.isEmpty(fullname)? rosteritem.get('fullname') || jid: fullname;
                             rosteritem.save({
-                                'fullname': fullname || jid,
+                                'fullname': fullname,
                                 'image_type': img_type,
                                 'image': img,
                                 'url': url,