Support hiding server part of username in message scrollback (#71)

This commit is contained in:
Ulyssa 2023-07-06 23:15:58 -07:00
parent 61aba80be1
commit 64891ec68f
No known key found for this signature in database
GPG key ID: F2873CA2997B83C5
8 changed files with 164 additions and 37 deletions

View file

@ -445,6 +445,9 @@ pub struct RoomInfo {
/// Users currently typing in this room, and when we received notification of them doing so.
pub users_typing: Option<(Instant, Vec<OwnedUserId>)>,
/// The display names for users in this room.
pub display_names: HashMap<OwnedUserId, String>,
}
impl RoomInfo {
@ -583,13 +586,13 @@ impl RoomInfo {
match n {
0 => Spans(vec![]),
1 => {
let user = settings.get_user_span(typers[0].as_ref());
let user = settings.get_user_span(typers[0].as_ref(), self);
Spans(vec![user, Span::from(" is typing...")])
},
2 => {
let user1 = settings.get_user_span(typers[0].as_ref());
let user2 = settings.get_user_span(typers[1].as_ref());
let user1 = settings.get_user_span(typers[0].as_ref(), self);
let user2 = settings.get_user_span(typers[1].as_ref(), self);
Spans(vec![
user1,
@ -835,11 +838,11 @@ impl<'de> Visitor<'de> for IambIdVisitor {
},
Some("members") => {
let Some(path) = url.path_segments() else {
return Err(E::custom( "Invalid members window URL"));
return Err(E::custom("Invalid members window URL"));
};
let &[room_id] = path.collect::<Vec<_>>().as_slice() else {
return Err(E::custom( "Invalid members window URL"));
return Err(E::custom("Invalid members window URL"));
};
let Ok(room_id) = OwnedRoomId::try_from(room_id) else {