Fix waiting rooms being sorted to bottom

This commit is contained in:
Joscha 2023-03-17 18:27:01 +01:00
parent 1e90e76fba
commit 4e2b597f1e
2 changed files with 4 additions and 4 deletions

View file

@ -25,6 +25,7 @@ Procedure when bumping the version number:
- Display colon-delimited emoji in nicks and messages - Display colon-delimited emoji in nicks and messages
- Non-export info is now printed to stderr instead of stdout - Non-export info is now printed to stderr instead of stdout
- Recognizes links without scheme (e. g. `euphoria.io` instead of `https://euphoria.io`) - Recognizes links without scheme (e. g. `euphoria.io` instead of `https://euphoria.io`)
- Rooms waiting for reconnect are no longer sorted to bottom in default sort order
### Fixed ### Fixed
- Mentions not being stopped by `>` - Mentions not being stopped by `>`

View file

@ -317,10 +317,9 @@ impl Rooms {
fn sort_rooms(&self, rooms: &mut [(&String, Option<&euph::State>, usize)]) { fn sort_rooms(&self, rooms: &mut [(&String, Option<&euph::State>, usize)]) {
match self.order { match self.order {
Order::Alphabet => rooms.sort_unstable_by_key(|(n, _, _)| *n), Order::Alphabet => rooms.sort_unstable_by_key(|(name, _, _)| *name),
Order::Importance => rooms.sort_unstable_by_key(|(n, s, u)| { Order::Importance => rooms.sort_unstable_by_key(|(name, state, unseen)| {
let no_instance = matches!(s, None | Some(euph::State::Disconnected)); (state.is_none(), *unseen == 0, *name)
(no_instance, *u == 0, *n)
}), }),
} }
} }