Merge pull request #5781 from matrix-org/t3chguy/fix/16739

Fix redaction event list summaries breaking sender profiles
This commit is contained in:
Travis Ralston 2021-03-22 15:52:36 -06:00 committed by GitHub
commit 2f8ed0bffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1044,6 +1044,10 @@ class RedactionGrouper {
}
shouldGroup(ev) {
// absorb hidden events so that they do not break up streams of messages & redaction events being grouped
if (!this.panel._shouldShowEvent(ev)) {
return true;
}
if (this.panel._wantsDateSeparator(this.events[0], ev.getDate())) {
return false;
}
@ -1055,6 +1059,9 @@ class RedactionGrouper {
ev.getId(),
ev === this.lastShownEvent,
);
if (!this.panel._shouldShowEvent(ev)) {
return;
}
this.events.push(ev);
}
@ -1080,13 +1087,9 @@ class RedactionGrouper {
);
const senders = new Set();
let eventTiles = this.events.map((e) => {
let eventTiles = this.events.map((e, i) => {
senders.add(e.sender);
// In order to prevent DateSeparators from appearing in the expanded form,
// render each member event as if the previous one was itself.
// This way, the timestamp of the previous event === the
// timestamp of the current event, and no DateSeparator is inserted.
return panel._getTilesForEvent(e, e, e === lastShownEvent);
return panel._getTilesForEvent(i === 0 ? this.prevEvent : this.events[i - 1], e, e === lastShownEvent);
}).reduce((a, b) => a.concat(b), []);
if (eventTiles.length === 0) {