Properly wait when clearing messages

This commit is contained in:
JC Brand 2019-11-14 15:16:24 +01:00
parent b4dafcc45b
commit 149fcf5d32
2 changed files with 4 additions and 5 deletions

View File

@ -377,8 +377,7 @@ converse.plugins.add('converse-chat', {
async clearMessages () {
try {
await Promise.all(this.messages.models.map(m => m.destroy()));
this.messages.reset();
await this.messages.clearSession();
} catch (e) {
this.messages.trigger('reset');
log.error(e);
@ -411,9 +410,9 @@ converse.plugins.add('converse-chat', {
_converse.api.trigger('chatReconnected', this);
},
onReconnection () {
async onReconnection () {
if (_converse.clear_messages_on_reconnection) {
this.clearMessages();
await this.clearMessages();
}
this.announceReconnection();
},

View File

@ -409,7 +409,7 @@ converse.plugins.add('converse-muc', {
this.removeNonMembers();
await this.refreshRoomFeatures();
if (_converse.clear_messages_on_reconnection) {
this.clearMessages();
await this.clearMessages();
}
if (!u.isPersistableModel(this)) {
// XXX: Happens during tests, nothing to do if this