mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-18 21:52:30 -04:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user