@@ -13,6 +13,7 @@ class FileUploader extends React.Component {
13
13
}
14
14
15
15
createDropzone ( ) {
16
+ const userId = this . props . project . owner ? this . props . project . owner . id : this . props . user . id ;
16
17
this . uploader = new Dropzone ( 'div#uploader' , {
17
18
url : s3Bucket ,
18
19
method : 'post' ,
@@ -30,7 +31,7 @@ class FileUploader extends React.Component {
30
31
text/plain,text/csv,.obj,video/webm,video/ogg,video/quicktime,video/mp4,
31
32
.otf,.ttf` ,
32
33
dictDefaultMessage : 'Drop files here to upload or click to use the file browser' ,
33
- accept : this . props . dropzoneAcceptCallback . bind ( this , this . props . project . owner . id ) ,
34
+ accept : this . props . dropzoneAcceptCallback . bind ( this , userId ) ,
34
35
sending : this . props . dropzoneSendingCallback ,
35
36
complete : this . props . dropzoneCompleteCallback
36
37
// error: (file, errorMessage) => {
@@ -53,24 +54,29 @@ FileUploader.propTypes = {
53
54
dropzoneCompleteCallback : PropTypes . func . isRequired ,
54
55
project : PropTypes . shape ( {
55
56
owner : PropTypes . shape ( {
56
- id : PropTypes . string . isRequired
57
+ id : PropTypes . string
57
58
} )
59
+ } ) ,
60
+ user : PropTypes . shape ( {
61
+ id : PropTypes . string
58
62
} )
59
63
} ;
60
64
61
65
FileUploader . defaultProps = {
62
66
project : {
63
67
id : undefined ,
64
- owner : {
65
- id : undefined
66
- }
68
+ owner : undefined
69
+ } ,
70
+ user : {
71
+ id : undefined
67
72
}
68
73
} ;
69
74
70
75
function mapStateToProps ( state ) {
71
76
return {
72
77
files : state . files ,
73
- project : state . project
78
+ project : state . project ,
79
+ user : state . user
74
80
} ;
75
81
}
76
82
0 commit comments