feat(ui): Use the new latest_event sorter in the room list.

This patch installs the `new_sorter_latest_event` in the room list.
This commit is contained in:
Ivan Enderlin
2025-09-03 14:24:08 +02:00
parent 8ff7e58bc0
commit c860be4969
2 changed files with 11 additions and 1 deletions

View File

@@ -1050,7 +1050,7 @@ impl RoomInfo {
/// Updates the recency stamp of this room.
///
/// Please read [`Self::recency_stamp`] to learn more.
/// Please read `Self::recency_stamp` to learn more.
pub fn update_recency_stamp(&mut self, stamp: u64) {
self.recency_stamp = Some(stamp);
}

View File

@@ -37,6 +37,7 @@ use super::{
filters::BoxedFilterFn,
sorters::{new_sorter_lexicographic, new_sorter_name, new_sorter_recency},
};
use crate::room_list_service::sorters::new_sorter_latest_event;
/// A `RoomList` represents a list of rooms, from a
/// [`RoomListService`](super::RoomListService).
@@ -165,7 +166,16 @@ impl RoomList {
let (values, stream) = (raw_values, merged_streams)
.filter(filter_fn)
.sort_by(new_sorter_lexicographic(vec![
// Sort by latest event's kind, i.e. put the rooms with a
// **local** latest event first.
Box::new(new_sorter_latest_event()),
// Sort rooms by their recency (either by looking
// at their latest event's timestamp, or their
// `recency_stamp`).
Box::new(new_sorter_recency()),
// Finally, sort by name.
Box::new(new_sorter_name())
]))
.dynamic_head_with_initial_value(page_size, limit_stream.clone());