diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index f262c649..5c3380a4 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -1952,7 +1952,7 @@ mod test { room_names.push(room.read().await.display_name()) } - assert_eq!(vec!["example, example2"], room_names); + assert_eq!(vec!["example2"], room_names); } #[tokio::test] diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index a4800dec..a2a82260 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -213,6 +213,7 @@ impl RoomName { /// pub fn calculate_name( &self, + own_user_id: &UserId, invited_members: &HashMap, joined_members: &HashMap, ) -> String { @@ -241,6 +242,7 @@ impl RoomName { // TODO: This should use `self.heroes` but it is always empty?? if heroes >= invited_joined { let mut names = members + .filter(|m| m.user_id != *own_user_id) .take(3) .map(|mem| { mem.display_name @@ -253,6 +255,7 @@ impl RoomName { names.join(", ") } else if heroes < invited_joined && invited + joined > one { let mut names = members + .filter(|m| m.user_id != *own_user_id) .take(3) .map(|mem| { mem.display_name @@ -302,7 +305,7 @@ impl Room { /// Return the display name of the room. pub fn display_name(&self) -> String { self.room_name - .calculate_name(&self.invited_members, &self.joined_members) + .calculate_name(&self.own_user_id, &self.invited_members, &self.joined_members) } /// Is the room a encrypted room. @@ -970,7 +973,7 @@ mod test { room_names.push(room.read().await.display_name()) } - assert_eq!(vec!["example, example2"], room_names); + assert_eq!(vec!["example2"], room_names); } #[async_test]