diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-15 12:51:20 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-15 14:06:56 +0100 |
commit | c51cf4efcaad26695382924e142d9a1ad2658754 (patch) | |
tree | 51b1aa02354c5c4d8975c7aa33ec059866ab294e /webclient/room/room-controller.js | |
parent | Added event handler service which.. handles events. More specifically, it $br... (diff) | |
download | synapse-c51cf4efcaad26695382924e142d9a1ad2658754.tar.xz |
Store messages in $rootScope so they can be accessed from multiple controllers without duplicated storage for each. This also gives updates.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r-- | webclient/room/room-controller.js | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index 301d3d6447..4c5415eace 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -28,7 +28,6 @@ angular.module('RoomController', []) can_paginate: true, // this is toggled off when we run out of items stream_failure: undefined // the response when the stream fails }; - $scope.messages = []; $scope.members = {}; $scope.stopPoll = false; @@ -43,13 +42,9 @@ angular.module('RoomController', []) }; $scope.$on(eventHandlerService.MSG_EVENT, function(ngEvent, event, isLive) { - if (isLive) { - $scope.messages.push(event); + if (isLive && event.room_id === $scope.room_id) { scrollToBottom(); } - else { - $scope.messages.unshift(event); - } }); $scope.$on(eventHandlerService.MEMBER_EVENT, function(ngEvent, event, isLive) { |