summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-10-26 14:15:07 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-10-26 14:45:13 -0400
commitff6e91f51d844a4703d3c4648b8b6bffe0cdabbc (patch)
tree0f6c2d250b671c15429966233289a9d19756f005
parentb46c01b2903d49903cfcf6588097cb72d599b391 (diff)
downloadchat-ff6e91f51d844a4703d3c4648b8b6bffe0cdabbc.tar.gz
chat-ff6e91f51d844a4703d3c4648b8b6bffe0cdabbc.tar.bz2
chat-ff6e91f51d844a4703d3c4648b8b6bffe0cdabbc.zip
Fixed file upload and profile picture upload error display to work for serverside errors
-rw-r--r--web/react/components/create_post.jsx10
-rw-r--r--web/react/components/user_settings/user_settings_general.jsx2
2 files changed, 9 insertions, 3 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index 055be112d..0867bfdf2 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -253,8 +253,14 @@ export default class CreatePost extends React.Component {
this.setState({uploadsInProgress: draft.uploadsInProgress, previews: draft.previews});
}
handleUploadError(err, clientId) {
+ let message = err;
+ if (message && typeof message !== 'string') {
+ // err is an AppError from the server
+ message = err.message;
+ }
+
if (clientId === -1) {
- this.setState({serverError: err});
+ this.setState({serverError: message});
} else {
const draft = PostStore.getDraft(this.state.channelId);
@@ -265,7 +271,7 @@ export default class CreatePost extends React.Component {
PostStore.storeDraft(this.state.channelId, draft);
- this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: err});
+ this.setState({uploadsInProgress: draft.uploadsInProgress, serverError: message});
}
}
handleTextDrop(text) {
diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx
index 70e559c30..1c8ce3c79 100644
--- a/web/react/components/user_settings/user_settings_general.jsx
+++ b/web/react/components/user_settings/user_settings_general.jsx
@@ -171,7 +171,7 @@ export default class UserSettingsGeneralTab extends React.Component {
}.bind(this),
function imageUploadFailure(err) {
var state = this.setupInitialState(this.props);
- state.serverError = err;
+ state.serverError = err.message;
this.setState(state);
}.bind(this)
);