Browse Source

Bugfix. Send model instance to event listeners

So that we can call `getDisplayName`
JC Brand 7 years ago
parent
commit
7e94f3c691
2 changed files with 5 additions and 3 deletions
  1. 4 1
      docs/source/events.rst
  2. 1 2
      src/converse-roster.js

+ 4 - 1
docs/source/events.rst

@@ -161,7 +161,10 @@ contactRequest
 
 
 Someone has requested to subscribe to your presence (i.e. to be your contact).
 Someone has requested to subscribe to your presence (i.e. to be your contact).
 
 
-``_converse.api.listen.on('contactRequest', function (user_data) { ... });``
+The `Backbone.Model <http://backbonejs.org/#Model>`_ instance representing the
+roster contact is passed to the event listener.
+
+``_converse.api.listen.on('contactRequest', function (contact) { ... });``
 
 
 contactRemoved
 contactRemoved
 ~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~

+ 1 - 2
src/converse-roster.js

@@ -600,8 +600,7 @@
                         'requesting': true,
                         'requesting': true,
                         'nickname': nickname
                         'nickname': nickname
                     };
                     };
-                    this.create(user_data);
-                    _converse.emit('contactRequest', user_data);
+                    _converse.emit('contactRequest', this.create(user_data));
                 },
                 },
 
 
                 handleIncomingSubscription (presence) {
                 handleIncomingSubscription (presence) {