mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
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:
commit
64974eb3ee
1 changed files with 4 additions and 1 deletions
|
@ -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()];
|
||||||
|
|
Loading…
Reference in a new issue