diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-09-01 13:29:17 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-09-01 13:29:17 +0100 |
commit | a9512d0994bba12cd3684d37030ce68ebe9330b3 (patch) | |
tree | 6a80e8f1fa89fccf0cd90ea251edb7c1fb28224c /webclient/user/user-controller.js | |
parent | Merge branch 'develop' into server2server_tls (diff) | |
parent | add another public wishlist item (diff) | |
download | synapse-a9512d0994bba12cd3684d37030ce68ebe9330b3.tar.xz |
Merge branch 'develop' into server2server_tls
Diffstat (limited to 'webclient/user/user-controller.js')
-rw-r--r-- | webclient/user/user-controller.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/webclient/user/user-controller.js b/webclient/user/user-controller.js index 620230561c..b5b2d439a2 100644 --- a/webclient/user/user-controller.js +++ b/webclient/user/user-controller.js @@ -25,14 +25,42 @@ angular.module('UserController', ['matrixService']) avatar_url: undefined }; + $scope.user_id = matrixService.config().user_id; + matrixService.getDisplayName($scope.user.id).then( function(response) { $scope.user.displayname = response.data.displayname; } ); + matrixService.getProfilePictureUrl($scope.user.id).then( function(response) { $scope.user.avatar_url = response.data.avatar_url; } ); + + $scope.messageUser = function() { + + // FIXME: create a new room every time, for now + + matrixService.create(null, 'private').then( + function(response) { + // This room has been created. Refresh the rooms list + var room_id = response.data.room_id; + console.log("Created room with id: "+ room_id); + + matrixService.invite(room_id, $scope.user.id).then( + function() { + $scope.feedback = "Invite sent successfully"; + $scope.$parent.goToPage("/room/" + room_id); + }, + function(reason) { + $scope.feedback = "Failure: " + JSON.stringify(reason); + }); + }, + function(error) { + $scope.feedback = "Failure: " + JSON.stringify(error.data); + }); + }; + }]); \ No newline at end of file |