[Room] Fix last event calculation
This commit is contained in:
parent
83e45bb719
commit
7a3056f741
|
@ -156,12 +156,17 @@ class Room {
|
||||||
Event get lastEvent {
|
Event get lastEvent {
|
||||||
ChatTime lastTime = ChatTime(0);
|
ChatTime lastTime = ChatTime(0);
|
||||||
Event lastEvent = null;
|
Event lastEvent = null;
|
||||||
states.forEach((String key, RoomState state) {
|
for (final entry in states.entries) {
|
||||||
if (state.time != null && state.time > lastTime) {
|
final RoomState state = entry.value;
|
||||||
|
if ((state.time != null && state.time > lastTime) ||
|
||||||
|
state.typeKey == "m.room.message") {
|
||||||
lastTime = state.time;
|
lastTime = state.time;
|
||||||
lastEvent = state.timelineEvent;
|
lastEvent = state.timelineEvent;
|
||||||
|
if (state.typeKey == "m.room.message") {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return lastEvent;
|
return lastEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue