Make fallback user mentions support also match against the bot's room-specific username

It seems like Element iOS benefits from this.
This commit is contained in:
Slavi Pantaleev
2024-10-03 16:28:49 +03:00
parent 393be9be5a
commit d9a045a5e4
5 changed files with 61 additions and 26 deletions

View File

@@ -172,6 +172,24 @@ impl Bot {
self.matrix_link().user_id()
}
pub(crate) async fn user_display_name_in_room(&self, room: &Room) -> Option<String> {
let bot_display_name = self
.room_display_name_fetcher()
.own_display_name_in_room(room)
.await;
match bot_display_name {
Ok(value) => value,
Err(err) => {
tracing::warn!(
?err,
"Failed to fetch bot display name. Proceeding without it"
);
None
}
}
}
pub(crate) fn reacting(&self) -> super::reacting::Reacting {
super::reacting::Reacting::new(self.clone())
}