mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-03 15:24:09 -04:00
Remove old polling stuff from RoomController. Added service comments. Do not start the event stream on startup unless you have credentials.
This commit is contained in:
parent
7ddb7a5cbb
commit
5ac87292c4
4 changed files with 20 additions and 45 deletions
|
@ -29,7 +29,6 @@ angular.module('RoomController', [])
|
|||
stream_failure: undefined // the response when the stream fails
|
||||
};
|
||||
$scope.members = {};
|
||||
$scope.stopPoll = false;
|
||||
|
||||
$scope.imageURLToSend = "";
|
||||
$scope.userIDToInvite = "";
|
||||
|
@ -71,40 +70,6 @@ angular.module('RoomController', [])
|
|||
)
|
||||
};
|
||||
|
||||
var shortPoll = function() {
|
||||
eventStreamService.resume().then(
|
||||
function(response) {
|
||||
$scope.state.stream_failure = undefined;
|
||||
console.log("Got response from "+$scope.state.events_from+" to "+response.data.end);
|
||||
$scope.state.events_from = response.data.end;
|
||||
$scope.feedback = "";
|
||||
|
||||
eventHandlerService.handleEvents(response.data.chunk, true);
|
||||
|
||||
if ($scope.stopPoll) {
|
||||
console.log("Stopping polling.");
|
||||
}
|
||||
else {
|
||||
$timeout(shortPoll, 0);
|
||||
}
|
||||
},
|
||||
function(error) {
|
||||
$scope.state.stream_failure = error;
|
||||
|
||||
if (error.status == 403) {
|
||||
$scope.stopPoll = true;
|
||||
}
|
||||
|
||||
if ($scope.stopPoll) {
|
||||
console.log("Stopping polling.");
|
||||
}
|
||||
else {
|
||||
$timeout(shortPoll, 5000);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
var updateMemberList = function(chunk) {
|
||||
var isNewMember = !(chunk.target_user_id in $scope.members);
|
||||
if (isNewMember) {
|
||||
|
@ -260,9 +225,4 @@ angular.module('RoomController', [])
|
|||
$scope.loadMoreHistory = function() {
|
||||
paginate(MESSAGES_PER_PAGINATION);
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function(e) {
|
||||
console.log("onDestroyed: Stopping poll.");
|
||||
$scope.stopPoll = true;
|
||||
});
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue