Merge pull request #5799 from matrix-org/t3chguy/redaction-groupere

[Release] Fix edge case with redaction grouper messing up continuations
This commit is contained in:
Michael Telatynski 2021-03-25 21:17:51 +00:00 committed by GitHub
commit 1f4437af39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,6 +46,9 @@ function shouldFormContinuation(prevEvent, mxEvent) {
// check if within the max continuation period
if (mxEvent.getTs() - prevEvent.getTs() > CONTINUATION_MAX_INTERVAL) return false;
// As we summarise redactions, do not continue a redacted event onto a non-redacted one and vice-versa
if (mxEvent.isRedacted() !== prevEvent.isRedacted()) return false;
// Some events should appear as continuations from previous events of different types.
if (mxEvent.getType() !== prevEvent.getType() &&
(!continuedTypes.includes(mxEvent.getType()) ||
@ -1125,7 +1128,7 @@ class RedactionGrouper {
}
getNewPrevEvent() {
return this.events[0];
return this.events[this.events.length - 1];
}
}