wrap fully qualified user IDs more intelligently
This commit is contained in:
parent
2fdf939ca9
commit
588dcf492b
|
@ -537,7 +537,7 @@ textarea, input {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
word-break: break-all;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.userPowerLevel {
|
.userPowerLevel {
|
||||||
|
|
|
@ -299,9 +299,10 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
|
||||||
* Return the display name of an user acccording to data already downloaded
|
* Return the display name of an user acccording to data already downloaded
|
||||||
* @param {String} room_id the room id
|
* @param {String} room_id the room id
|
||||||
* @param {String} user_id the id of the user
|
* @param {String} user_id the id of the user
|
||||||
|
* @param {boolean} wrap whether to insert whitespace into the userid (if displayname not available) to help it wrap
|
||||||
* @returns {String} the user displayname or user_id if not available
|
* @returns {String} the user displayname or user_id if not available
|
||||||
*/
|
*/
|
||||||
var getUserDisplayName = function(room_id, user_id) {
|
var getUserDisplayName = function(room_id, user_id, wrap) {
|
||||||
var displayName;
|
var displayName;
|
||||||
|
|
||||||
// Get the user display name from the member list of the room
|
// Get the user display name from the member list of the room
|
||||||
|
@ -337,6 +338,12 @@ 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;
|
displayName = user_id;
|
||||||
|
if (wrap) {
|
||||||
|
displayName = user_id.substr(0, user_id.indexOf(':')) + " " + user_id.substr(user_id.indexOf(':'));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
displayName = user_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return displayName;
|
return displayName;
|
||||||
};
|
};
|
||||||
|
@ -589,10 +596,11 @@ function(matrixService, $rootScope, $q, $timeout, $filter, mPresence, notificati
|
||||||
* Return the display name of an user acccording to data already downloaded
|
* Return the display name of an user acccording to data already downloaded
|
||||||
* @param {String} room_id the room id
|
* @param {String} room_id the room id
|
||||||
* @param {String} user_id the id of the user
|
* @param {String} user_id the id of the user
|
||||||
|
* @param {boolean} wrap whether to insert whitespace into the userid (if displayname not available) to help it wrap
|
||||||
* @returns {String} the user displayname or user_id if not available
|
* @returns {String} the user displayname or user_id if not available
|
||||||
*/
|
*/
|
||||||
getUserDisplayName: function(room_id, user_id) {
|
getUserDisplayName: function(room_id, user_id, wrap) {
|
||||||
return getUserDisplayName(room_id, user_id);
|
return getUserDisplayName(room_id, user_id, wrap);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -114,7 +114,7 @@ function($rootScope, matrixService, eventHandlerService, modelService) {
|
||||||
|
|
||||||
// Return the user display name
|
// Return the user display name
|
||||||
.filter('mUserDisplayName', ['eventHandlerService', function(eventHandlerService) {
|
.filter('mUserDisplayName', ['eventHandlerService', function(eventHandlerService) {
|
||||||
return function(user_id, room_id) {
|
return function(user_id, room_id, wrap) {
|
||||||
return eventHandlerService.getUserDisplayName(room_id, user_id);
|
return eventHandlerService.getUserDisplayName(room_id, user_id, wrap);
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -134,13 +134,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="userName">
|
<div class="userName">
|
||||||
<pie-chart ng-show="member.powerLevelNorm" data="[ (member.powerLevelNorm + 0), (100 - member.powerLevelNorm) ]"></pie-chart>
|
<pie-chart ng-show="member.powerLevelNorm" data="[ (member.powerLevelNorm + 0), (100 - member.powerLevelNorm) ]"></pie-chart>
|
||||||
<span ng-show="member.displayname">
|
{{ member.id | mUserDisplayName:room_id:true }}
|
||||||
{{ member.id | mUserDisplayName: room_id }}
|
|
||||||
</span>
|
|
||||||
<span ng-hide="member.displayname">
|
|
||||||
{{ member.id.substr(0, member.id.indexOf(':')) }}<br/>
|
|
||||||
{{ member.id.substr(member.id.indexOf(':')) }}
|
|
||||||
</span>
|
|
||||||
<span ng-show="member.last_active_ago" style="color: #aaa">({{ member.last_active_ago + (now - member.last_updated) | duration }})</span>
|
<span ng-show="member.last_active_ago" style="color: #aaa">({{ member.last_active_ago + (now - member.last_updated) | duration }})</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -159,7 +153,7 @@
|
||||||
ng-class="msg.echo_msg_state">
|
ng-class="msg.echo_msg_state">
|
||||||
{{ (msg.origin_server_ts) | date:'MMM d HH:mm' }}
|
{{ (msg.origin_server_ts) | date:'MMM d HH:mm' }}
|
||||||
</div>
|
</div>
|
||||||
<div class="sender" ng-hide="room.events[$index - 1].user_id === msg.user_id || msg.user_id === state.user_id"> {{ msg.__room_member.cnt.displayname || msg.user_id | mUserDisplayName: room_id }}</div>
|
<div class="sender" ng-hide="room.events[$index - 1].user_id === msg.user_id || msg.user_id === state.user_id"> {{ msg.__room_member.cnt.displayname || msg.user_id | mUserDisplayName:room_id:true }}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="avatar">
|
<td class="avatar">
|
||||||
<!-- msg.__room_member.avatar_url is just backwards compat, and can be removed in the future. -->
|
<!-- msg.__room_member.avatar_url is just backwards compat, and can be removed in the future. -->
|
||||||
|
|
Loading…
Reference in New Issue