SYWEB-15: Always show the room alias as well as its name in the UI

This commit is contained in:
Emmanuel ROHEE 2014-09-17 15:38:20 +02:00
parent b3a0961c6c
commit 9aed6a06cf

View File

@ -26,11 +26,6 @@ angular.module('matrixFilter', [])
// If there is an alias, use it // If there is an alias, use it
// TODO: only one alias is managed for now // TODO: only one alias is managed for now
var alias = matrixService.getRoomIdToAliasMapping(room_id); var alias = matrixService.getRoomIdToAliasMapping(room_id);
if (alias) {
roomName = alias;
}
if (undefined === roomName) {
var room = $rootScope.events.rooms[room_id]; var room = $rootScope.events.rooms[room_id];
if (room) { if (room) {
@ -39,6 +34,9 @@ angular.module('matrixFilter', [])
if (room_name_event) { if (room_name_event) {
roomName = room_name_event.content.name; roomName = room_name_event.content.name;
} }
else if (alias) {
roomName = alias;
}
else if (room.members) { else if (room.members) {
// Else, build the name from its users // Else, build the name from its users
// FIXME: Is it still required? // FIXME: Is it still required?
@ -90,6 +88,10 @@ angular.module('matrixFilter', [])
} }
} }
} }
// Always show the alias in the room displayed name
if (roomName && alias && alias !== roomName) {
roomName += " (" + alias + ")";
} }
if (undefined === roomName) { if (undefined === roomName) {