summaryrefslogtreecommitdiffstats
path: root/web/react/components/file_attachment.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-08-25 13:17:21 -0700
committerCorey Hulen <corey@hulen.com>2015-08-25 13:17:21 -0700
commiteb5af31c17f1f8ff1dabdbfeaf4d7ae24700d6ac (patch)
tree8407caf850b9246b30d7ce2ca6726e66244b7ce2 /web/react/components/file_attachment.jsx
parentb4ee26373042d2c5ab422a4955022fb278cb8fa1 (diff)
parent64b179ab0e6a66c0f8edb72ab24ef28bbc2f9969 (diff)
downloadchat-eb5af31c17f1f8ff1dabdbfeaf4d7ae24700d6ac.tar.gz
chat-eb5af31c17f1f8ff1dabdbfeaf4d7ae24700d6ac.tar.bz2
chat-eb5af31c17f1f8ff1dabdbfeaf4d7ae24700d6ac.zip
Merge pull request #466 from mattermost/mm-1912
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);
}