mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-28 21:22:02 +00:00
getUserDisplayName: Disambiguate users who have the same displayname in the room.
Displayname are then disambiguate where it is necessary
This commit is contained in:
parent
72eb360f2d
commit
ef99a5d972
@ -373,6 +373,21 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
|
||||
var member = getMember(room_id, user_id);
|
||||
if (member && member.content.displayname) { // Do not consider null displayname
|
||||
displayName = member.content.displayname;
|
||||
|
||||
// Disambiguate users who have the same displayname in the room
|
||||
if (user_id !== matrixService.config().user_id) {
|
||||
var room = $rootScope.events.rooms[room_id];
|
||||
|
||||
for (var member_id in room.members) {
|
||||
if (room.members.hasOwnProperty(member_id) && member_id !== user_id) {
|
||||
var member2 = room.members[member_id];
|
||||
if (member2.content.displayname && member2.content.displayname === displayName) {
|
||||
displayName = displayName + " (" + user_id + ")";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The user may not have joined the room yet. So try to resolve display name from presence data
|
||||
|
Loading…
Reference in New Issue
Block a user