瀏覽代碼

Make sure removeFromRoster is called only once

JC Brand 7 年之前
父節點
當前提交
93a20ee4ee
共有 1 個文件被更改,包括 3 次插入3 次删除
  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