2
0
Эх сурвалжийг харах

Make sure messages Collection exists when we receive an error message

JC Brand 5 жил өмнө
parent
commit
faa02b058d

+ 1 - 1
src/headless/converse-chat.js

@@ -310,13 +310,13 @@ converse.plugins.add('converse-chat', {
                     return;
                     return;
                 }
                 }
                 this.set({'box_id': `box-${btoa(jid)}`});
                 this.set({'box_id': `box-${btoa(jid)}`});
+                this.initMessages();
 
 
                 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.on('change:chat_state', this.sendChatState, this);
                 this.on('change:chat_state', this.sendChatState, this);
-                this.initMessages();
                 await this.fetchMessages();
                 await this.fetchMessages();
                 /**
                 /**
                  * Triggered once a {@link _converse.ChatBox} has been created and initialized.
                  * Triggered once a {@link _converse.ChatBox} has been created and initialized.