From f633fb0bd56f4cb74ed7f41c489060f58e07f323 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Wed, 3 Jul 2024 09:08:07 +0200 Subject: [PATCH] !fixup recency doc --- .../matrix-sdk-ui/src/room_list_service/sorters/recency.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-ui/src/room_list_service/sorters/recency.rs b/crates/matrix-sdk-ui/src/room_list_service/sorters/recency.rs index f1e545f135b..0a65685b8f3 100644 --- a/crates/matrix-sdk-ui/src/room_list_service/sorters/recency.rs +++ b/crates/matrix-sdk-ui/src/room_list_service/sorters/recency.rs @@ -36,7 +36,7 @@ where // // The way our `Room` types are implemented makes it so they are sharing the // same data, because they are all built from the same store. They can be seen - // as shallow clones of each others. In practise it's really great: a `Room` can + // as shallow clones of each others. In practice it's really great: a `Room` can // never be outdated. However, for the case of sorting rooms, it breaks the // search algorithm. `left` and `right` will have the exact same `LatestEvent`, // so `left` and `right` will always be `Ordering::Equal`. This is wrong: if @@ -46,9 +46,8 @@ where // `Equal`, the position may not change. It actually depends of the search // algorithm used by [`eyeball_im_util::SortBy`]. // - // Since this sorter is sorting rooms from the most recent latest event to the - // oldest, we should return `Ordering::Greatest`: the room is greatest to its - // previous version. + // Since this room received an update, it is more recent than the previous one + // we matched against, so return `Ordering::Greater`. return Ordering::Greater; }