handle case for #169 where project does not yet have an owner
This commit is contained in:
parent
aaa5e868e2
commit
99152f6e37
1 changed files with 12 additions and 6 deletions
|
@ -13,6 +13,7 @@ class FileUploader extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
createDropzone() {
|
createDropzone() {
|
||||||
|
const userId = this.props.project.owner ? this.props.project.owner.id : this.props.user.id;
|
||||||
this.uploader = new Dropzone('div#uploader', {
|
this.uploader = new Dropzone('div#uploader', {
|
||||||
url: s3Bucket,
|
url: s3Bucket,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -30,7 +31,7 @@ class FileUploader extends React.Component {
|
||||||
text/plain,text/csv,.obj,video/webm,video/ogg,video/quicktime,video/mp4,
|
text/plain,text/csv,.obj,video/webm,video/ogg,video/quicktime,video/mp4,
|
||||||
.otf,.ttf`,
|
.otf,.ttf`,
|
||||||
dictDefaultMessage: 'Drop files here to upload or click to use the file browser',
|
dictDefaultMessage: 'Drop files here to upload or click to use the file browser',
|
||||||
accept: this.props.dropzoneAcceptCallback.bind(this, this.props.project.owner.id),
|
accept: this.props.dropzoneAcceptCallback.bind(this, userId),
|
||||||
sending: this.props.dropzoneSendingCallback,
|
sending: this.props.dropzoneSendingCallback,
|
||||||
complete: this.props.dropzoneCompleteCallback
|
complete: this.props.dropzoneCompleteCallback
|
||||||
// error: (file, errorMessage) => {
|
// error: (file, errorMessage) => {
|
||||||
|
@ -53,24 +54,29 @@ FileUploader.propTypes = {
|
||||||
dropzoneCompleteCallback: PropTypes.func.isRequired,
|
dropzoneCompleteCallback: PropTypes.func.isRequired,
|
||||||
project: PropTypes.shape({
|
project: PropTypes.shape({
|
||||||
owner: PropTypes.shape({
|
owner: PropTypes.shape({
|
||||||
id: PropTypes.string.isRequired
|
id: PropTypes.string
|
||||||
})
|
})
|
||||||
|
}),
|
||||||
|
user: PropTypes.shape({
|
||||||
|
id: PropTypes.string
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
FileUploader.defaultProps = {
|
FileUploader.defaultProps = {
|
||||||
project: {
|
project: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
owner: {
|
owner: undefined
|
||||||
|
},
|
||||||
|
user: {
|
||||||
id: undefined
|
id: undefined
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
return {
|
return {
|
||||||
files: state.files,
|
files: state.files,
|
||||||
project: state.project
|
project: state.project,
|
||||||
|
user: state.user
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue