Fix decrypted events replaced by encrypted ones

This commit is contained in:
miruka
2019-07-08 13:29:05 -04:00
parent 861347ce64
commit faccc7ba90
2 changed files with 8 additions and 7 deletions

View File

@@ -127,8 +127,14 @@ function onTimelineEventReceived(
if (found.length > 0) {
timelines.set(found[0], item)
} else {
// Multiple clients will emit duplicate events with the same eventId
}
// Multiple clients will emit duplicate events with the same eventId
else if (item.eventType == "OlmEvent" || item.eventType == "MegolmEvent") {
// Don't replace if an item with the same eventId is found in these
// cases, because it would be the ecrypted version of the event.
timelines.upsert({"eventId": event_id}, item, false, 250)
}
else {
timelines.upsert({"eventId": event_id}, item, true, 250)
}
}