1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Clean up a codepath that was only used for crypto messages

Transmission of encrypted messages was happening somewhat differently to
normal messages. In particular, we weren't copying the 'unsigned' field when we
got the remote-echo, which meant the 'sync' code didn't correctly match up the
echo with the original.

The separate codepath was becoming a thorn in my side, so fix things up to
bring it back in line.
This commit is contained in:
Richard van der Hoff
2016-03-15 15:07:26 +00:00
parent 899ff6cea2
commit 07bbe358ea
2 changed files with 9 additions and 24 deletions

View File

@@ -621,8 +621,13 @@ Room.prototype._addLiveEvents = function(events) {
this._eventIdToTimeline[events[i].getId()] = existingTimeline;
}
// replace the event source
// replace the event source, but preserve the original content
// and type in case it was encrypted (we won't be able to
// decrypt it, even though we sent it.)
var existingSource = existingEvent.event;
existingEvent.event = events[i].event;
existingEvent.event.content = existingSource.content;
existingEvent.event.type = existingSource.type;
// successfully sent.
existingEvent.status = null;