Explorar o código

Make sure removeFromRoster is called only once

JC Brand %!s(int64=7) %!d(string=hai) anos
pai
achega
93a20ee4ee
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      src/converse-core.js

+ 3 - 3
src/converse-core.js

@@ -887,7 +887,6 @@
                     'user_id': Strophe.getNodeFromJid(jid)
                 }, attributes));
 
-                this.on('destroy', () => { this.removeFromRoster(); });
                 this.on('change:chat_status', function (item) {
                     _converse.emit('contactStatusChanged', item.attributes);
                 });
@@ -935,7 +934,8 @@
                  *    (String) jid - The Jabber ID of the user who is unsubscribing
                  */
                 _converse.connection.send($pres({'type': 'unsubscribe', 'to': this.get('jid')}));
-                this.destroy(); // Will cause removeFromRoster to be called.
+                this.removeFromRoster();
+                this.destroy();
             },
 
             unauthorize (message) {
@@ -1320,7 +1320,7 @@
                     }, {sort: false});
                 } else {
                     if (subscription === "remove") {
-                        return contact.destroy(); // will trigger removeFromRoster
+                        return contact.destroy();
                     }
                     // We only find out about requesting contacts via the
                     // presence handler, so if we receive a contact