Actually set room when running SetRoomCommand #79
|
@ -64,7 +64,7 @@ async fn get_rooms_for_user(
|
|||
) -> Result<Vec<RoomNameAndId>, BotError> {
|
||||
let user_id = UserId::try_from(user_id)?;
|
||||
let rooms_for_user = matrix::get_rooms_for_user(client, &user_id).await?;
|
||||
let rooms_for_user: Vec<RoomNameAndId> = stream::iter(rooms_for_user)
|
||||
let mut rooms_for_user: Vec<RoomNameAndId> = stream::iter(rooms_for_user)
|
||||
.filter_map(|room| async move {
|
||||
Some(room.display_name().await.map(|room_name| RoomNameAndId {
|
||||
id: room.room_id().to_string(),
|
||||
|
@ -74,6 +74,12 @@ async fn get_rooms_for_user(
|
|||
.try_collect()
|
||||
.await?;
|
||||
|
||||
//Alphabetically descending, symbols first, ignore case.
|
||||
let sort = |r1: &RoomNameAndId, r2: &RoomNameAndId| {
|
||||
r1.name.to_lowercase().cmp(&r2.name.to_lowercase())
|
||||
};
|
||||
|
||||
rooms_for_user.sort_by(sort);
|
||||
Ok(rooms_for_user)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue