diff --git a/matrix_sdk_base/src/models/message.rs b/matrix_sdk_base/src/models/message.rs index 215293ee..cc07ce59 100644 --- a/matrix_sdk_base/src/models/message.rs +++ b/matrix_sdk_base/src/models/message.rs @@ -176,6 +176,7 @@ mod test { serde_json::json!({ "!roomid:example.com": { "room_id": "!roomid:example.com", + "disambiguated_display_names": {}, "room_name": { "name": null, "canonical_alias": null, @@ -225,6 +226,7 @@ mod test { let json = serde_json::json!({ "!roomid:example.com": { "room_id": "!roomid:example.com", + "disambiguated_display_names": {}, "room_name": { "name": null, "canonical_alias": null, diff --git a/matrix_sdk_base/src/models/room.rs b/matrix_sdk_base/src/models/room.rs index e163c9ff..5757350d 100644 --- a/matrix_sdk_base/src/models/room.rs +++ b/matrix_sdk_base/src/models/room.rs @@ -181,8 +181,8 @@ pub struct Room { pub unread_notifications: Option, /// The tombstone state of this room. pub tombstone: Option, - /// The map of display names - display_names: HashMap, + /// The map of disambiguated display names for users who have the same display name + disambiguated_display_names: HashMap, } impl RoomName { @@ -281,7 +281,7 @@ impl Room { unread_highlight: None, unread_notifications: None, tombstone: None, - display_names: HashMap::new(), + disambiguated_display_names: HashMap::new(), } } @@ -304,7 +304,7 @@ impl Room { /// Get the resolved display name for a member of this room. pub fn member_display_name<'a>(&'a self, id: &UserId) -> Option> { - self.display_names + self.disambiguated_display_names .get(id) .map(|s| s.as_str().into()) .or_else(|| { @@ -331,7 +331,7 @@ impl Room { // find all users that share the same display name as the joining user let users_with_same_name: Vec<_> = self - .display_names + .disambiguated_display_names .iter() .filter(|(_, v)| { member @@ -363,11 +363,11 @@ impl Room { // update all existing users with same name for (id, member) in users_with_same_name { - self.display_names.insert(id, member); + self.disambiguated_display_names.insert(id, member); } // insert new member's display name - self.display_names.insert( + self.disambiguated_display_names.insert( member.user_id.clone(), member .display_name diff --git a/matrix_sdk_base/src/state/mod.rs b/matrix_sdk_base/src/state/mod.rs index dfcf71fd..cb2ec449 100644 --- a/matrix_sdk_base/src/state/mod.rs +++ b/matrix_sdk_base/src/state/mod.rs @@ -154,7 +154,7 @@ mod test { "own_user_id": "@example:example.com", "creator": null, "members": {}, - "display_names": {}, + "disambiguated_display_names": {}, "typing_users": [], "power_levels": null, "encrypted": null, @@ -171,7 +171,7 @@ mod test { serde_json::json!({ "!roomid:example.com": { "room_id": "!roomid:example.com", - "display_names": {}, + "disambiguated_display_names": {}, "room_name": { "name": null, "canonical_alias": null,