diff options
Diffstat (limited to 'web/react/components/create_post.jsx')
-rw-r--r-- | web/react/components/create_post.jsx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index 3e1faba7d..377e7bd34 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -145,16 +145,20 @@ module.exports = React.createClass({ this.setState({uploadsInProgress: draft['uploadsInProgress'], previews: draft['previews']}); }, handleUploadError: function(err, clientId) { - var draft = PostStore.getDraft(this.state.channelId); + if (clientId !== -1) { + var draft = PostStore.getDraft(this.state.channelId); - var index = draft['uploadsInProgress'].indexOf(clientId); - if (index !== -1) { - draft['uploadsInProgress'].splice(index, 1); - } + var index = draft['uploadsInProgress'].indexOf(clientId); + if (index !== -1) { + draft['uploadsInProgress'].splice(index, 1); + } - PostStore.storeDraft(this.state.channelId, draft); + PostStore.storeDraft(this.state.channelId, draft); - this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + this.setState({uploadsInProgress: draft['uploadsInProgress'], serverError: err}); + } else { + this.setState({serverError: err}); + } }, removePreview: function(id) { var previews = this.state.previews; @@ -224,7 +228,6 @@ module.exports = React.createClass({ </div> ); } - var allowTextFormatting = config.AllowTextFormatting; var postError = null; if (this.state.postError) { @@ -245,10 +248,6 @@ module.exports = React.createClass({ if (postError) { postFooterClassName += ' has-error'; } - var extraInfo = <MsgTyping channelId={this.state.channel_id} parentId='' />; - if (this.state.messageText.split(' ').length > 1 && allowTextFormatting) { - extraInfo = <span className='msg-typing'>_<em>italics</em>_ *<strong>bold</strong>* `<code className='code-info'>code</code>`</span>; - } return ( <form id='create_post' ref='topDiv' role='form' onSubmit={this.handleSubmit}> @@ -267,13 +266,15 @@ module.exports = React.createClass({ getFileCount={this.getFileCount} onUploadStart={this.handleUploadStart} onFileUpload={this.handleFileUploadComplete} - onUploadError={this.handleUploadError} /> + onUploadError={this.handleUploadError} + postType='post' + channelId='' /> </div> <div className={postFooterClassName}> {postError} {serverError} {preview} - {extraInfo} + <MsgTyping channelId={this.state.channelId} parentId=''/> </div> </div> </form> |