mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Use the correct timeline reference for message previews
Fixes https://github.com/vector-im/riot-web/issues/14083 (hopefully) This is the same logic used by `Unread.js`, so should be correct.
This commit is contained in:
parent
bd2c585a72
commit
115c850d35
1 changed files with 2 additions and 3 deletions
|
@ -78,9 +78,8 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private generatePreview(room: Room) {
|
private generatePreview(room: Room) {
|
||||||
const timeline = room.getLiveTimeline();
|
const events = room.timeline;
|
||||||
if (!timeline) return; // usually only happens in tests
|
if (!events) return; // should only happen in tests
|
||||||
const events = timeline.getEvents();
|
|
||||||
|
|
||||||
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) return; // limit reached
|
||||||
|
|
Loading…
Reference in a new issue