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