summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-14 17:40:27 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-14 17:40:38 +0100
commit5de086b736218d43bd51c3b83ca26118806488a2 (patch)
tree0b4bcad068b903bb512feba3ca1214c2fd75d9ed /webclient/room/room-controller.js
parentWe can now upload avatar image somewhere (diff)
downloadsynapse-5de086b736218d43bd51c3b83ca26118806488a2.tar.xz
More helpful display when the event stream fails, wiping it when the connection is regained.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 8003105654..fb6e2025fc 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -25,7 +25,8 @@ angular.module('RoomController', [])
         user_id: matrixService.config().user_id,
         events_from: "END", // when to start the event stream from.
         earliest_token: "END", // stores how far back we've paginated.
-        can_paginate: true
+        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 = {};
@@ -76,7 +77,7 @@ angular.module('RoomController', [])
                 }
             },
             function(error) {
-                console.log("paginateBackMessages Ruh roh: " + JSON.stringify(error));
+                console.log("Failed to paginateBackMessages: " + JSON.stringify(error));
             }
         )
     };
@@ -89,6 +90,7 @@ angular.module('RoomController', [])
                 "timeout": 5000
             }})
             .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 = "";
@@ -102,7 +104,7 @@ angular.module('RoomController', [])
                     $timeout(shortPoll, 0);
                 }
             }, function(response) {
-                $scope.feedback = "Can't stream: " + response.data;
+                $scope.state.stream_failure = response;
 
                 if (response.status == 403) {
                     $scope.stopPoll = true;
@@ -215,7 +217,7 @@ angular.module('RoomController', [])
         // Join the room
         matrixService.join($scope.room_id).then(
             function() {
-                console.log("Joined room");
+                console.log("Joined room "+$scope.room_id);
                 // Now start reading from the stream
                 $timeout(shortPoll, 0);