fix stupid truncation bug

This commit is contained in:
Matthew Hodgson 2014-11-11 05:50:55 +00:00
parent 7df8c8c287
commit bf944d9219
1 changed files with 5 additions and 2 deletions

View File

@ -304,6 +304,7 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
*/ */
var getUserDisplayName = function(room_id, user_id, wrap) { var getUserDisplayName = function(room_id, user_id, wrap) {
var displayName; var displayName;
// XXX: this is getting called *way* too often - at least once per every room member per every digest...
// Get the user display name from the member list of the room // Get the user display name from the member list of the room
var member = modelService.getMember(room_id, user_id); var member = modelService.getMember(room_id, user_id);
@ -337,14 +338,16 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
if (undefined === displayName) { if (undefined === displayName) {
// By default, use the user ID // By default, use the user ID
displayName = user_id; if (wrap && user_id.indexOf(':') >= 0) {
if (wrap) {
displayName = user_id.substr(0, user_id.indexOf(':')) + " " + user_id.substr(user_id.indexOf(':')); displayName = user_id.substr(0, user_id.indexOf(':')) + " " + user_id.substr(user_id.indexOf(':'));
} }
else { else {
displayName = user_id; displayName = user_id;
} }
} }
//console.log("getUserDisplayName(" + room_id + ", " + user_id + ", " + wrap +") = " + displayName);
return displayName; return displayName;
}; };