Commit 149fcf5d authored by JC Brand's avatar JC Brand

Properly wait when clearing messages

parent b4dafcc4
......@@ -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();
},
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment