From 9d3246ed12b3cfe587bd96149af288e92b64e362 Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Thu, 25 Sep 2014 11:49:43 +0200 Subject: [PATCH] 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 --- webclient/app-filter.js | 22 ---------------------- webclient/room/room.html | 12 ++++++++++-- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/webclient/app-filter.js b/webclient/app-filter.js index 9443446c9f..fc16492ef3 100644 --- a/webclient/app-filter.js +++ b/webclient/app-filter.js @@ -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) { diff --git a/webclient/room/room.html b/webclient/room/room.html index 2786246232..b99413cbbf 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -48,7 +48,15 @@ width="80" height="80"/>
-
{{ member.displayname || member.id.substr(0, member.id.indexOf(':')) }}
{{ member.displayname ? "" : member.id.substr(member.id.indexOf(':')) }}
+
+
+ {{ member.id | mUserDisplayName: room_id }} +
+
+ {{ member.id.substr(0, member.id.indexOf(':')) }}
+ {{ member.id.substr(member.id.indexOf(':')) }} +
+
{{ member.last_active_ago + (now - member.last_updated) | duration }}
ago
@@ -65,7 +73,7 @@ -
{{ members[msg.user_id].displayname || msg.user_id }}
+
{{ msg.user_id | mUserDisplayName: room_id }}
{{ (msg.content.hsob_ts || msg.ts) | date:'MMM d HH:mm' }}