Skip to content
Snippets Groups Projects
Commit 4c228df1 authored by Erik Johnston's avatar Erik Johnston
Browse files

Use the new 'inviter' key from im sync for room display names.

parent 14b99896
Branches
Tags
No related merge requests found
...@@ -59,7 +59,7 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload', ...@@ -59,7 +59,7 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
// FIXME push membership to top level key to match /im/sync // FIXME push membership to top level key to match /im/sync
event.membership = event.content.membership; event.membership = event.content.membership;
// FIXME bodge a nicer name than the room ID for this invite. // FIXME bodge a nicer name than the room ID for this invite.
event.room_alias = event.user_id + "'s room"; event.room_display_name = event.user_id + "'s room";
$scope.rooms[event.room_id] = event; $scope.rooms[event.room_id] = event;
} }
}); });
...@@ -70,15 +70,20 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload', ...@@ -70,15 +70,20 @@ angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload',
if (alias) { if (alias) {
// use the existing alias from storage // use the existing alias from storage
data[i].room_alias = alias; data[i].room_alias = alias;
data[i].room_display_name = alias;
} }
else if (data[i].aliases && data[i].aliases[0]) { else if (data[i].aliases && data[i].aliases[0]) {
// save the mapping // save the mapping
// TODO: select the smarter alias from the array // TODO: select the smarter alias from the array
matrixService.createRoomIdToAliasMapping(data[i].room_id, data[i].aliases[0]); matrixService.createRoomIdToAliasMapping(data[i].room_id, data[i].aliases[0]);
data[i].room_display_name = data[i].aliases[0];
}
else if (data[i].membership == "invite" && "inviter" in data[i]) {
data[i].room_display_name = data[i].inviter + "'s room"
} }
else { else {
// last resort use the room id // last resort use the room id
data[i].room_alias = data[i].room_id; data[i].room_display_name = data[i].room_id;
} }
} }
return data; return data;
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<div class="rooms" ng-repeat="(rm_id, room) in rooms"> <div class="rooms" ng-repeat="(rm_id, room) in rooms">
<div> <div>
<a href="#/room/{{ room.room_alias ? room.room_alias : rm_id }}" >{{ room.room_alias }}</a> {{room.membership === 'invite' ? ' (invited)' : ''}} <a href="#/room/{{ room.room_alias ? room.room_alias : rm_id }}" >{{ room.room_display_name }}</a> {{room.membership === 'invite' ? ' (invited)' : ''}}
</div> </div>
</div> </div>
<br/> <br/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment