diff options
author | Matthew Hodgson <matthew@matrix.org> | 2014-08-16 20:48:05 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2014-08-16 20:48:05 +0100 |
commit | fe25e65f3f6c4bce9b61c8136cbd0585455321a3 (patch) | |
tree | 0761665bc8ab3d59473e81d50825dbd5c91e6df1 /webclient | |
parent | make presence timestamps less verbose (diff) | |
download | synapse-fe25e65f3f6c4bce9b61c8136cbd0585455321a3.tar.xz |
disambiguate identical displaynames
Diffstat (limited to 'webclient')
-rw-r--r-- | webclient/app.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/webclient/app.js b/webclient/app.js index f6ce69e403..a6668da6eb 100644 --- a/webclient/app.js +++ b/webclient/app.js @@ -117,12 +117,34 @@ matrixWebClient .filter('orderMembersList', function($sce) { return function(members) { var filtered = []; + + var displayNames = {}; 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 (i=0; i < value.length; i++) { + var v = value[i]; + members[v].displayname += " (" + v + ")"; + console.log(v + " " + members[v]); + }; + } + }); + filtered.sort(function (a, b) { - return ((a["mtime_age"] || 10e10)> (b["mtime_age"] || 10e10) ? 1 : -1); + return ((a["mtime_age"] || 10e10) > (b["mtime_age"] || 10e10) ? 1 : -1); }); return filtered; }; |