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";
}
);
}
diff --git a/syweb/webclient/room/room.html b/syweb/webclient/room/room.html
index 955f5ff114..8baf9eda71 100644
--- a/syweb/webclient/room/room.html
+++ b/syweb/webclient/room/room.html
@@ -198,31 +198,45 @@
{{ msg.user_id }} changed their display name from {{ msg.prev_content.displayname }} to {{ msg.content.displayname }}
</span>
- <span ng-show='msg.content.msgtype === "m.emote"'
- ng-class="msg.echo_msg_state"
- ng-bind-html="'* ' + (msg.__room_member.cnt.displayname || msg.user_id) + ' ' + msg.content.body | linky:'_blank'"
- />
-
- <span ng-show='msg.content.msgtype === "m.text"'
- class="message"
- ng-class="containsBingWord(msg) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
- ng-bind-html="(msg.content.msgtype === 'm.text' && msg.type === 'm.room.message' && msg.content.format === 'org.matrix.custom.html') ?
- (msg.content.formatted_body | unsanitizedLinky) :
- (msg.content.msgtype === 'm.text' && msg.type === 'm.room.message') ? (msg.content.body | linky:'_blank') : '' "/>
+ <span ng-show='msg.type === "m.room.message"' ng-switch='msg.content.msgtype'>
+ <span ng-switch-when="m.emote"
+ ng-class="containsBingWord(msg) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
+ ng-bind-html="'* ' + (msg.__room_member.cnt.displayname || msg.user_id) + ' ' + msg.content.body | linky:'_blank'"
+ />
+
+ <span ng-switch-when="m.text"
+ class="message"
+ ng-class="containsBingWord(msg) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
+ ng-bind-html="(msg.content.format === 'org.matrix.custom.html') ? (msg.content.formatted_body | unsanitizedLinky) : (msg.content.body | linky:'_blank') "/>
+
+ <div ng-switch-when="m.image">
+ <div ng-hide='msg.content.thumbnail_url' ng-style="msg.content.body.h && { 'height' : (msg.content.body.h < 320) ? msg.content.body.h : 320}">
+ <img class="image" ng-src="{{ msg.content.url }}"/>
+ </div>
+ <div ng-show='msg.content.thumbnail_url' ng-style="{ 'height' : msg.content.thumbnail_info.h }">
+ <img class="image mouse-pointer" ng-src="{{ msg.content.thumbnail_url }}"
+ ng-click="$parent.$parent.fullScreenImageURL = msg.content.url; $event.stopPropagation();"/>
+ </div>
+ </div>
+
+ <span ng-switch-when="m.file" ng-class="msg.echo_msg_state">
+ <a href="{{ msg.content.url}}" target="_blank">{{ msg.content.body }}</a>
+ <div ng-show='msg.content.thumbnail_url' ng-style="{ 'height' : msg.content.thumbnail_info.h }">
+ <a href="{{ msg.content.url}}" target="_blank">
+ <img class="image mouse-pointer" ng-src="{{ msg.content.thumbnail_url }}"/>
+ </a>
+ </div>
+ </span>
+
+ <span ng-switch-default
+ ng-class="containsBingWord(msg) && msg.user_id != state.user_id ? msg.echo_msg_state + ' messageBing' : msg.echo_msg_state"
+ ng-bind-html="msg.content.body | linky:'_blank'"
+ />
+ </span>
<span ng-show='msg.type === "m.call.invite" && msg.user_id == state.user_id'>Outgoing Call{{ isWebRTCSupported() ? '' : ' (But your browser does not support VoIP)' }}</span>
<span ng-show='msg.type === "m.call.invite" && msg.user_id != state.user_id'>Incoming Call{{ isWebRTCSupported() ? '' : ' (But your browser does not support VoIP)' }}</span>
- <div ng-show='msg.content.msgtype === "m.image"'>
- <div ng-hide='msg.content.thumbnail_url' ng-style="msg.content.body.h && { 'height' : (msg.content.body.h < 320) ? msg.content.body.h : 320}">
- <img class="image" ng-src="{{ msg.content.url }}"/>
- </div>
- <div ng-show='msg.content.thumbnail_url' ng-style="{ 'height' : msg.content.thumbnail_info.h }">
- <img class="image mouse-pointer" ng-src="{{ msg.content.thumbnail_url }}"
- ng-click="$parent.fullScreenImageURL = msg.content.url; $event.stopPropagation();"/>
- </div>
- </div>
-
<span ng-if="'m.room.topic' === msg.type">
{{ msg.__room_member.cnt.displayname || msg.user_id }} changed the topic to: {{ msg.content.topic }}
</span>
@@ -250,7 +264,7 @@
<div id="controlPanel">
<div id="controls">
- <button id="attachButton" m-file-input="imageFileToSend" class="extraControls" ng-disabled="state.permission_denied"></button>
+ <button id="attachButton" m-file-input="fileToSend" class="extraControls" ng-disabled="state.permission_denied"></button>
<textarea id="mainInput" rows="1" ng-enter="send()"
ng-disabled="state.permission_denied"
ng-focus="true" autocomplete="off" tab-complete command-history="room_id"/>
|