summary refs log tree commit diff
path: root/webclient/home
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-02 13:55:14 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-02 13:55:23 +0200
commitd5da6b0cef598aa4abae2ff5a2c9867d0aa64a8f (patch)
tree34700332e7685f9edaee3da1a057d03d7f76a3d9 /webclient/home
parentOrder matters when adding REST servlets (diff)
downloadsynapse-d5da6b0cef598aa4abae2ff5a2c9867d0aa64a8f.tar.xz
Handle "m.room.create" in order to inform controllers about new rooms
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();
     };
 }]);