summaryrefslogtreecommitdiffstats
path: root/web/react/components/file_attachment.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-08-24 15:03:52 -0700
committer=Corey Hulen <corey@hulen.com>2015-08-24 15:03:52 -0700
commit64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969 (patch)
tree3094d69abb3e9bd32a14587c8d787c9ad8f0b688 /web/react/components/file_attachment.jsx
parent930488f002c819efed7e3afc982b73d1c06a9bbe (diff)
downloadchat-64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969.tar.gz
chat-64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969.tar.bz2
chat-64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969.zip
Fixes mm-1912 move get file info into its own web service call
Diffstat (limited to 'web/react/components/file_attachment.jsx')
-rw-r--r--web/react/components/file_attachment.jsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/web/react/components/file_attachment.jsx b/web/react/components/file_attachment.jsx
index c36c908d2..ab550d500 100644
--- a/web/react/components/file_attachment.jsx
+++ b/web/react/components/file_attachment.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
var utils = require('../utils/utils.jsx');
+var Client = require('../utils/client.jsx');
var Constants = require('../utils/constants.jsx');
module.exports = React.createClass({
@@ -103,12 +104,16 @@ module.exports = React.createClass({
if (this.state.fileSize < 0) {
var self = this;
- // asynchronously request the size of the file so that we can display it next to the thumbnail
- utils.getFileSize(utils.getFileUrl(filename), function(fileSize) {
- if (self.canSetState) {
- self.setState({fileSize: fileSize});
+ Client.getFileInfo(
+ filename,
+ function(data) {
+ if (self.canSetState) {
+ self.setState({fileSize: parseInt(data["size"], 10)});
+ }
+ },
+ function(err) {
}
- });
+ );
} else {
fileSizeString = utils.fileSizeToString(this.state.fileSize);
}