summary refs log tree commit diff
path: root/webclient/home
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/home')
-rw-r--r--webclient/home/home-controller.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/webclient/home/home-controller.js b/webclient/home/home-controller.js
index 847918d5dc..f4ce3053ea 100644
--- a/webclient/home/home-controller.js
+++ b/webclient/home/home-controller.js
@@ -17,8 +17,8 @@ limitations under the License.
 'use strict';
 
 angular.module('HomeController', ['matrixService', 'eventHandlerService', 'RecentsController'])
-.controller('HomeController', ['$scope', '$location', 'matrixService', 
-                               function($scope, $location, matrixService) {
+.controller('HomeController', ['$scope', '$location', 'matrixService', 'eventHandlerService', 
+                               function($scope, $location, matrixService, eventHandlerService) {
 
     $scope.config = matrixService.config();
     $scope.public_rooms = [];
@@ -72,7 +72,6 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen
                 response.data.room_id);
                 matrixService.createRoomIdToAliasMapping(
                     response.data.room_id, response.data.room_alias);
-                refresh();
             },
             function(error) {
                 $scope.feedback = "Failure: " + error.data;
@@ -133,6 +132,14 @@ angular.module('HomeController', ['matrixService', 'eventHandlerService', 'Recen
             } 
         );
 
+        // Listen to room creation event in order to update the public rooms list
+        $scope.$on(eventHandlerService.ROOM_CREATE_EVENT, function(ngEvent, event, isLive) {
+            if (isLive) {
+                // As we do not know if this room is public, do a full list refresh
+                refresh();
+            }
+        });
+
         refresh();
     };
 }]);