From ec13ce08d718a1864b8609a8d7088ef58ce70b68 Mon Sep 17 00:00:00 2001 From: Val Lorentz Date: Sun, 5 Nov 2023 11:17:55 +0100 Subject: [PATCH] Use canonical alias in buflist when possible --- src/buffers/room.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/buffers/room.rs b/src/buffers/room.rs index a24d2f8..f4017c8 100644 --- a/src/buffers/room.rs +++ b/src/buffers/room.rs @@ -288,7 +288,14 @@ impl RoomBuffer { #[async_trait] impl Buffer for RoomBuffer { fn short_name(&self) -> String { - self.room_id.as_str().to_owned() + self + .buffers + .iter() + .flat_map(|buf| buf.client.get_room(&self.room_id)) + .flat_map(|room| room.canonical_alias()) // TODO: .display_name() is better, but async :( + .map(|alias| alias.as_str().to_owned()) + .next() + .unwrap_or(self.room_id.as_str().to_owned()) } fn room_id(&self) -> Option<&RoomId> {