Commit f1f641ce authored by JC Brand's avatar JC Brand

Makes more sense to destroy a message outside of `showMessage`

Also ensures that we don't trigger `messageAdded` for a destroyed
message.
parent 615b5b08
......@@ -796,11 +796,6 @@ converse.plugins.add('converse-chatview', {
* @param { _converse.Message } message - The message object
*/
async showMessage (message) {
if (!u.isNewMessage(message) && u.isEmptyMessage(message)) {
// Handle archived or delayed messages without any message
// text to show.
return message.destroy();
}
const view = this.add(message.get('id'), new _converse.MessageView({'model': message}));
await view.render();
......@@ -844,6 +839,10 @@ converse.plugins.add('converse-chatview', {
// We already have a view for this message
return;
}
if (!u.isNewMessage(message) && u.isEmptyMessage(message)) {
// Ignore archived or delayed messages without any text to show.
return message.destroy();
}
await this.showMessage(message);
/**
* Triggered once a message has been added to a chatbox.
......
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