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', { ...@@ -377,8 +377,7 @@ converse.plugins.add('converse-chat', {
async clearMessages () { async clearMessages () {
try { try {
await Promise.all(this.messages.models.map(m => m.destroy())); await this.messages.clearSession();
this.messages.reset();
} catch (e) { } catch (e) {
this.messages.trigger('reset'); this.messages.trigger('reset');
log.error(e); log.error(e);
...@@ -411,9 +410,9 @@ converse.plugins.add('converse-chat', { ...@@ -411,9 +410,9 @@ converse.plugins.add('converse-chat', {
_converse.api.trigger('chatReconnected', this); _converse.api.trigger('chatReconnected', this);
}, },
onReconnection () { async onReconnection () {
if (_converse.clear_messages_on_reconnection) { if (_converse.clear_messages_on_reconnection) {
this.clearMessages(); await this.clearMessages();
} }
this.announceReconnection(); this.announceReconnection();
}, },
......
...@@ -409,7 +409,7 @@ converse.plugins.add('converse-muc', { ...@@ -409,7 +409,7 @@ converse.plugins.add('converse-muc', {
this.removeNonMembers(); this.removeNonMembers();
await this.refreshRoomFeatures(); await this.refreshRoomFeatures();
if (_converse.clear_messages_on_reconnection) { if (_converse.clear_messages_on_reconnection) {
this.clearMessages(); await this.clearMessages();
} }
if (!u.isPersistableModel(this)) { if (!u.isPersistableModel(this)) {
// XXX: Happens during tests, nothing to do if 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