diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-11-17 10:21:51 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-11-17 10:21:51 +0000 |
commit | 1d3ef8734cea9a1ce8befdf27db297ca70cfeee3 (patch) | |
tree | 12c7ac945749c68b81e3ae55c39dfd58ae824bf0 /syweb/webclient/room/room-controller.js | |
parent | Merge PDUs and Events into one object (diff) | |
parent | Move getLastMessage to modelService. (diff) | |
download | synapse-1d3ef8734cea9a1ce8befdf27db297ca70cfeee3.tar.xz |
Merge remote-tracking branch 'origin/develop' into merge_pdu_event_objects
Diffstat (limited to 'syweb/webclient/room/room-controller.js')
-rw-r--r-- | syweb/webclient/room/room-controller.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/syweb/webclient/room/room-controller.js b/syweb/webclient/room/room-controller.js index cf9bc1fcdb..fdd10d7c9a 100644 --- a/syweb/webclient/room/room-controller.js +++ b/syweb/webclient/room/room-controller.js @@ -495,6 +495,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a }); }; + // used to send an image based on just a URL, rather than uploading one $scope.sendImage = function(url, body) { scrollToBottom(true); @@ -507,23 +508,23 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput', 'a }); }; - $scope.imageFileToSend; - $scope.$watch("imageFileToSend", function(newValue, oldValue) { - if ($scope.imageFileToSend) { - // Upload this image with its thumbnail to Internet - mFileUpload.uploadImageAndThumbnail($scope.imageFileToSend, THUMBNAIL_SIZE).then( - function(imageMessage) { - // imageMessage is complete message structure, send it as is - matrixService.sendMessage($scope.room_id, undefined, imageMessage).then( + $scope.fileToSend; + $scope.$watch("fileToSend", function(newValue, oldValue) { + if ($scope.fileToSend) { + // Upload this file + mFileUpload.uploadFileAndThumbnail($scope.fileToSend, THUMBNAIL_SIZE).then( + function(fileMessage) { + // fileMessage is complete message structure, send it as is + matrixService.sendMessage($scope.room_id, undefined, fileMessage).then( function() { - console.log("Image message sent"); + console.log("File message sent"); }, function(error) { - $scope.feedback = "Failed to send image message: " + error.data.error; + $scope.feedback = "Failed to send file message: " + error.data.error; }); }, function(error) { - $scope.feedback = "Can't upload image"; + $scope.feedback = "Can't upload file"; } ); } |