From d5da6b0cef598aa4abae2ff5a2c9867d0aa64a8f Mon Sep 17 00:00:00 2001 From: Emmanuel ROHEE Date: Tue, 2 Sep 2014 13:55:14 +0200 Subject: Handle "m.room.create" in order to inform controllers about new rooms --- webclient/home/home-controller.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'webclient/home') 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(); }; }]); -- cgit 1.4.1