Recents update: do not care of events coming from the past (they are fired when doing pagination of room messages in the past)

This commit is contained in:
Emmanuel ROHEE 2014-08-29 09:55:47 +02:00
parent 9b2cb41dcf
commit 089d1b1b78
1 changed files with 4 additions and 2 deletions

View File

@ -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;
}
});
};