mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 11:02:13 -04:00
Store messages in $rootScope so they can be accessed from multiple controllers without duplicated storage for each. This also gives updates.
This commit is contained in:
parent
5dbceaf5a4
commit
c51cf4efca
3 changed files with 29 additions and 12 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue