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:
Travis Ralston 2020-06-22 15:57:13 -06:00
parent bd2c585a72
commit 115c850d35

View file

@ -78,9 +78,8 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
}
private generatePreview(room: Room) {
const timeline = room.getLiveTimeline();
if (!timeline) return; // usually only happens in tests
const events = timeline.getEvents();
const events = room.timeline;
if (!events) return; // should only happen in tests
for (let i = events.length - 1; i >= 0; i--) {
if (i === events.length - MAX_EVENTS_BACKWARDS) return; // limit reached