summary refs log tree commit diff
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
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.
-rw-r--r--webclient/room/room-controller.js10
-rw-r--r--webclient/room/room.html5
2 files changed, 10 insertions, 5 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);
 
diff --git a/webclient/room/room.html b/webclient/room/room.html
index 0f86a158ec..3b9ba713de 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -86,7 +86,10 @@
                     <button ng-click="inviteUser(userIDToInvite)">Invite</button>
             </span>
             <button ng-click="leaveRoom()">Leave</button>
-            <button ng-click="loadMoreHistory()" ng-disabled="!state.can_paginate">MOAR HISTORY</button>
+            <button ng-click="loadMoreHistory()" ng-disabled="!state.can_paginate">Load more history</button>
+            <div ng-hide="!state.stream_failure">
+                {{ state.stream_failure.data.error || "Connection failure" }}
+            </div>
         </div>
     </div>