diff options
Diffstat (limited to 'webclient/recents')
-rw-r--r-- | webclient/recents/recents-controller.js | 11 | ||||
-rw-r--r-- | webclient/recents/recents.html | 45 |
2 files changed, 36 insertions, 20 deletions
diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js index 3209f2cbdf..0f27f7a660 100644 --- a/webclient/recents/recents-controller.js +++ b/webclient/recents/recents-controller.js @@ -16,7 +16,7 @@ 'use strict'; -angular.module('RecentsController', ['matrixService', 'eventHandlerService']) +angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHandlerService']) .controller('RecentsController', ['$scope', 'matrixService', 'eventHandlerService', function($scope, matrixService, eventHandlerService) { $scope.rooms = {}; @@ -28,13 +28,8 @@ angular.module('RecentsController', ['matrixService', 'eventHandlerService']) var listenToEventStream = function() { // Refresh the list on matrix invitation and message event $scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { - var config = matrixService.config(); - 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; - - $scope.rooms[event.room_id] = event; + if (isLive) { + $scope.rooms[event.room_id].lastMsg = event; } }); $scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index 9978e08b13..280d0632ab 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -6,7 +6,7 @@ ng-class="{'recentsRoomSelected': (room.room_id === recentsSelectedRoomID)}"> <tr> <td class="recentsRoomName"> - {{ room.room_id | roomName }} + {{ room.room_id | mRoomName }} </td> <td class="recentsRoomSummaryTS"> {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} @@ -16,27 +16,48 @@ <tr> <td colspan="2" class="recentsRoomSummary"> - <div ng-show="room.membership === 'invite'" > - {{ room.inviter }} invited you + <div ng-show="room.membership === 'invite'"> + {{ room.lastMsg.inviter | mUserDisplayName: room.room_id }} invited you </div> - - <div ng-hide="room.membership === 'invite'" ng-switch="room.lastMsg.type" > - <div ng-switch-when="m.room.member"> - {{ room.lastMsg.user_id }} - {{ {"join": "joined", "leave": "left", "invite": "invited", "ban": "banned"}[msg.content.membership] }} - {{ (msg.content.membership === "invite" || msg.content.membership === "ban") ? (msg.state_key || '') : '' }} + + <div ng-hide="room.membership === 'invite'" ng-switch="room.lastMsg.type"> + <div ng-switch-when="m.room.member"> + <span ng-if="'join' === room.lastMsg.content.membership"> + {{ room.lastMsg.state_key | mUserDisplayName: room.room_id}} joined + </span> + <span ng-if="'leave' === room.lastMsg.content.membership"> + <span ng-if="room.lastMsg.user_id === room.lastMsg.state_key"> + {{room.lastMsg.state_key | mUserDisplayName: room.room_id }} left + </span> + <span ng-if="room.lastMsg.user_id !== room.lastMsg.state_key"> + {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} + {{ {"join": "kicked", "ban": "unbanned"}[room.lastMsg.content.prev] }} + {{ room.lastMsg.state_key | mUserDisplayName: room.room_id }} + </span> + <span ng-if="'join' === room.lastMsg.content.prev && room.lastMsg.content.reason"> + : {{ room.lastMsg.content.reason }} + </span> + </span> + <span ng-if="'invite' === room.lastMsg.content.membership || 'ban' === room.lastMsg.content.membership"> + {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} + {{ {"invite": "invited", "ban": "banned"}[room.lastMsg.content.membership] }} + {{ room.lastMsg.state_key | mUserDisplayName: room.room_id }} + <span ng-if="'ban' === room.lastMsg.content.prev && room.lastMsg.content.reason"> + : {{ room.lastMsg.content.reason }} + </span> + </span> </div> <div ng-switch-when="m.room.message"> <div ng-switch="room.lastMsg.content.msgtype"> <div ng-switch-when="m.text"> - {{ room.lastMsg.user_id }} : + {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} : <span ng-bind-html="(room.lastMsg.content.body) | linky:'_blank'"> </span> </div> <div ng-switch-when="m.image"> - {{ room.lastMsg.user_id }} sent an image + {{ room.lastMsg.user_id | mUserDisplayName: room.room_id }} sent an image </div> <div ng-switch-when="m.emote"> @@ -51,7 +72,7 @@ </div> <div ng-switch-default> - <div ng-if="room.lastMsg.type.indexOf('m.call.') == 0"> + <div ng-if="room.lastMsg.type.indexOf('m.call.') === 0"> Call </div> </div> |