Process events list client side

This commit is contained in:
2025-11-25 09:48:49 +01:00
parent a7bfd713c3
commit 5eab7c3e4f
5 changed files with 191 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ impl APIEvent {
pub struct APIEventsList {
pub start: String,
pub end: Option<String>,
pub messages: Vec<APIEvent>,
pub events: Vec<APIEvent>,
}
/// Get messages for a given room
@@ -65,7 +65,7 @@ pub(super) async fn get_events(
Ok(APIEventsList {
start: messages.start,
end: messages.end,
messages: stream::iter(messages.chunk)
events: stream::iter(messages.chunk)
.then(async |msg| APIEvent::from_evt(msg, room.room_id()).await)
.collect::<Vec<_>>()
.await

View File

@@ -52,7 +52,7 @@ impl APIRoomInfo {
is_space: r.is_space(),
parents: parent_spaces,
number_unread_messages: r.unread_notification_counts().notification_count,
latest_event: get_events(r, 1, None).await?.messages.into_iter().next(),
latest_event: get_events(r, 1, None).await?.events.into_iter().next(),
})
}
}