Fixed SYWEB-36: use getUserDisplayName for disambiguating display name in member list and message sender name. This method is robust when disambiguation is no more required

This commit is contained in:
Emmanuel ROHEE 2014-09-25 11:49:43 +02:00
parent ef99a5d972
commit 9d3246ed12
2 changed files with 10 additions and 24 deletions

View file

@ -45,28 +45,6 @@ angular.module('matrixWebClient')
angular.forEach(members, function(value, key) {
value["id"] = key;
filtered.push( value );
if (value["displayname"]) {
if (!displayNames[value["displayname"]]) {
displayNames[value["displayname"]] = [];
}
displayNames[value["displayname"]].push(key);
}
});
// FIXME: we shouldn't disambiguate displayNames on every orderMembersList
// invocation but keep track of duplicates incrementally somewhere
angular.forEach(displayNames, function(value, key) {
if (value.length > 1) {
// console.log(key + ": " + value);
for (var i=0; i < value.length; i++) {
var v = value[i];
// FIXME: this permenantly rewrites the displayname for a given
// room member. which means we can't reset their name if it is
// no longer ambiguous!
members[v].displayname += " (" + v + ")";
// console.log(v + " " + members[v]);
};
}
});
filtered.sort(function (a, b) {