diff options
Diffstat (limited to 'webclient/rooms')
-rw-r--r-- | webclient/rooms/rooms-controller.js | 20 | ||||
-rw-r--r-- | webclient/rooms/rooms.html | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/webclient/rooms/rooms-controller.js b/webclient/rooms/rooms-controller.js index 58420e0eb2..33912d63f9 100644 --- a/webclient/rooms/rooms-controller.js +++ b/webclient/rooms/rooms-controller.js @@ -18,6 +18,10 @@ angular.module('RoomsController', ['matrixService']) room_id: "", }; + $scope.joinAlias = { + room_alias: "", + }; + $scope.newProfileInfo = { name: matrixService.config().displayName, avatar: matrixService.config().avatarUrl @@ -106,6 +110,22 @@ angular.module('RoomsController', ['matrixService']) ); }; + $scope.joinAlias = function(room_alias) { + matrixService.joinAlias(room_alias).then( + function(response) { + if (response.hasOwnProperty("room_id")) { + $location.path("room/" + response.room_id); + return; + } else { + // TODO (erikj): Do something here? + } + }, + function(reason) { + $scope.feedback = "Can't join room: " + reason; + } + ); + }; + $scope.setDisplayName = function(newName) { matrixService.setDisplayName(newName).then( function(response) { diff --git a/webclient/rooms/rooms.html b/webclient/rooms/rooms.html index 04b153982e..f134e5ee8c 100644 --- a/webclient/rooms/rooms.html +++ b/webclient/rooms/rooms.html @@ -68,8 +68,8 @@ </div> <div> <form> - <input size="40" ng-model="goToRoom.room_id" ng-enter="goToRoom(goToRoom.room_id)" placeholder="(e.g. #foo_channe:example.org)"/> - <button ng-disabled="!goToRoom.room_id" ng-click="goToRoom(goToRoom.room_id)">Go to room</button> + <input size="40" ng-model="joinAlias.room_alias" ng-enter="joinAlias(joinAlias.room_alias)" placeholder="(e.g. #foo_channe:example.org)"/> + <button ng-disabled="!joinAlias.room_alias" ng-click="joinAlias(joinAlias.room_alias)">Join room</button> </form> </div> <br/> |