Sfoglia il codice sorgente

Fix `this` binding bug

JC Brand 4 anni fa
parent
commit
3bdae848b3
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/headless/plugins/chat/model.js

+ 1 - 1
src/headless/plugins/chat/model.js

@@ -58,7 +58,7 @@ const ChatBox = ModelWithContact.extend({
         if (this.get('type') === _converse.PRIVATE_CHAT_TYPE) {
         if (this.get('type') === _converse.PRIVATE_CHAT_TYPE) {
             this.presence = _converse.presences.findWhere({'jid': jid}) || _converse.presences.create({'jid': jid});
             this.presence = _converse.presences.findWhere({'jid': jid}) || _converse.presences.create({'jid': jid});
             await this.setRosterContact(jid);
             await this.setRosterContact(jid);
-            this.presence.on('change:show', this.onPresenceChanged);
+            this.presence.on('change:show', item => this.onPresenceChanged(item));
         }
         }
         this.on('change:chat_state', this.sendChatState, this);
         this.on('change:chat_state', this.sendChatState, this);