diff options
Diffstat (limited to 'webclient/recents')
-rw-r--r-- | webclient/recents/recents-controller.js | 19 | ||||
-rw-r--r-- | webclient/recents/recents.html | 5 |
2 files changed, 17 insertions, 7 deletions
diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index 803ab420f9..d33d41a922 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -29,7 +29,7 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) // Refresh the list on matrix invitation and message event $scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { var config = matrixService.config(); - if (event.state_key === config.user_id && event.content.membership === "invite") { + if (isLive && event.state_key === config.user_id && event.content.membership === "invite") { console.log("Invited to room " + event.room_id); // FIXME push membership to top level key to match /im/sync event.membership = event.content.membership; @@ -39,7 +39,9 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) } }); $scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { - $scope.rooms[event.room_id].lastMsg = event; + if (isLive) { + $scope.rooms[event.room_id].lastMsg = event; + } }); }; @@ -53,13 +55,16 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) // Reset data $scope.rooms = {}; - var data = matrixService.assignRoomAliases(response.data.rooms); - for (var i=0; i<data.length; i++) { - $scope.rooms[data[i].room_id] = data[i]; + var rooms = response.data.rooms; + for (var i=0; i<rooms.length; i++) { + var room = rooms[i]; + + // Add room_alias & room_display_name members + $scope.rooms[room.room_id] = angular.extend(room, matrixService.getRoomAliasAndDisplayName(room)); // Create a shortcut for the last message of this room - if (data[i].messages && data[i].messages.chunk && data[i].messages.chunk[0]) { - $scope.rooms[data[i].room_id].lastMsg = data[i].messages.chunk[0]; + if (room.messages && room.messages.chunk && room.messages.chunk[0]) { + $scope.rooms[room.room_id].lastMsg = room.messages.chunk[0]; } } diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index 6fda6c5c6b..3f025a98d8 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -39,6 +39,11 @@ {{ room.lastMsg.user_id }} sent an image </div> + <div ng-switch-when="m.emote"> + <span ng-bind-html="'* ' + (room.lastMsg.user_id) + ' ' + room.lastMsg.content.body | linky:'_blank'"> + </span> + </div> + <div ng-switch-default> {{ room.lastMsg.content }} </div> |