Skip to content

Commit d163d1c

Browse files
committed
feat(ui): Use the new latest_event sorter in the room list.
This patch installs the `new_sorter_latest_event` in the room list.
1 parent 0306ccb commit d163d1c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

crates/matrix-sdk-base/src/room/room_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ impl RoomInfo {
10501050

10511051
/// Updates the recency stamp of this room.
10521052
///
1053-
/// Please read [`Self::recency_stamp`] to learn more.
1053+
/// Please read `Self::recency_stamp` to learn more.
10541054
pub fn update_recency_stamp(&mut self, stamp: u64) {
10551055
self.recency_stamp = Some(stamp);
10561056
}

crates/matrix-sdk-ui/src/room_list_service/room_list.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use super::{
3737
filters::BoxedFilterFn,
3838
sorters::{new_sorter_lexicographic, new_sorter_name, new_sorter_recency},
3939
};
40+
use crate::room_list_service::sorters::new_sorter_latest_event;
4041

4142
/// A `RoomList` represents a list of rooms, from a
4243
/// [`RoomListService`](super::RoomListService).
@@ -165,7 +166,16 @@ impl RoomList {
165166
let (values, stream) = (raw_values, merged_streams)
166167
.filter(filter_fn)
167168
.sort_by(new_sorter_lexicographic(vec![
169+
// Sort by latest event's kind, i.e. put the rooms with a
170+
// **local** latest event first.
171+
Box::new(new_sorter_latest_event()),
172+
173+
// Sort rooms by their recency (either by looking
174+
// at their latest event's timestamp, or their
175+
// `recency_stamp`).
168176
Box::new(new_sorter_recency()),
177+
178+
// Finally, sort by name.
169179
Box::new(new_sorter_name())
170180
]))
171181
.dynamic_head_with_initial_value(page_size, limit_stream.clone());

0 commit comments

Comments
 (0)