From 9cc37e6918fcbf53744612704ab53bce7290c7fd Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Mon, 23 Jan 2017 15:23:14 +0100 Subject: Move instances of Client.uploadFile() in components to an action (#5165) --- webapp/components/file_upload.jsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/file_upload.jsx b/webapp/components/file_upload.jsx index 36beb8c91..a821fedab 100644 --- a/webapp/components/file_upload.jsx +++ b/webapp/components/file_upload.jsx @@ -4,7 +4,6 @@ import $ from 'jquery'; import 'jquery-dragster/jquery.dragster.js'; import ReactDOM from 'react-dom'; -import Client from 'client/web_client.jsx'; import Constants from 'utils/constants.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import DelayedAction from 'utils/delayed_action.jsx'; @@ -13,6 +12,8 @@ import * as Utils from 'utils/utils.jsx'; import {intlShape, injectIntl, defineMessages} from 'react-intl'; +import {uploadFile} from 'actions/file_actions.jsx'; + const holders = defineMessages({ limited: { id: 'file_upload.limited', @@ -89,13 +90,14 @@ class FileUpload extends React.Component { // generate a unique id that can be used by other components to refer back to this upload const clientId = Utils.generateId(); - const request = Client.uploadFile(files[i], - files[i].name, - channelId, - clientId, - this.fileUploadSuccess.bind(this, channelId), - this.fileUploadFail.bind(this, clientId, channelId) - ); + const request = uploadFile( + files[i], + files[i].name, + channelId, + clientId, + this.fileUploadSuccess.bind(this, channelId), + this.fileUploadFail.bind(this, clientId) + ); const requests = this.state.requests; requests[clientId] = request; @@ -271,7 +273,8 @@ class FileUpload extends React.Component { const name = formatMessage(holders.pasted) + d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + hour + '-' + min + '.' + ext; - const request = Client.uploadFile(file, + const request = uploadFile( + file, name, channelId, clientId, -- cgit v1.2.3-1-g7c22