Commit 681c3a2c authored by JC Brand's avatar JC Brand

Corrections bugfix. Don't save new `id` on message model

otherwise a new cache entry gets created, causing multiple messages to
be restored from cache later on.
parent 1bc3f28e
......@@ -1480,6 +1480,8 @@
.toBe('But soft, what light through yonder chimney breaks?');
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(view.el.querySelectorAll('.chat-msg__content .fa-edit').length).toBe(1);
expect(view.model.messages.models.length).toBe(1);
expect(view.model.messages.browserStorage.records.length).toBe(1);
_converse.chatboxes.onMessage($msg({
'from': sender_jid,
......@@ -1501,6 +1503,8 @@
expect(older_msgs.length).toBe(2);
expect(older_msgs[0].childNodes[0].nodeName).toBe('TIME');
expect(older_msgs[0].childNodes[1].textContent).toBe(': But soft, what light through yonder airlock breaks?');
expect(view.model.messages.models.length).toBe(1);
expect(view.model.messages.browserStorage.records.length).toBe(1);
done();
}));
......
......@@ -485,6 +485,7 @@ converse.plugins.add('converse-chatboxes', {
// This is a correction of an earlier message we already received
older_versions[message.get('time')] = message.get('message');
attrs = Object.assign(attrs, {'older_versions': older_versions});
delete attrs['id']; // Delete id, otherwise a new cache entry gets created
message.save(attrs);
}
return message;
......
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