Merge pull request #5661 from matrix-org/travis/clear-preview

Clear message previews when the maximum limit is reached for history
This commit is contained in:
Travis Ralston 2021-02-18 07:31:54 -07:00 committed by GitHub
commit 64974eb3ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -124,7 +124,10 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
let changed = false; let changed = false;
for (let i = events.length - 1; i >= 0; i--) { for (let i = events.length - 1; i >= 0; i--) {
if (i === events.length - MAX_EVENTS_BACKWARDS) return; // limit reached if (i === events.length - MAX_EVENTS_BACKWARDS) {
// limit reached - clear the preview by breaking out of the loop
break;
}
const event = events[i]; const event = events[i];
const previewDef = PREVIEWS[event.getType()]; const previewDef = PREVIEWS[event.getType()];