Added check to make sure files are not strings

Этот коммит содержится в:
Reed Garmsen
2015-08-11 15:31:07 -07:00
родитель 9f9d93e613
Коммит 6f091f0f6d
5 изменённых файлов: 8 добавлений и 22 удалений

Просмотреть файл

@@ -84,13 +84,17 @@ module.exports = React.createClass({
this.props.onUploadError(null); this.props.onUploadError(null);
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
if (files.length) { if (!files.length) {
files = e.originalEvent.dataTransfer.getData('URL');
}
var channelId = this.props.channelId || ChannelStore.getCurrentId();
if (typeof files !== 'string' && files.length) {
var numFiles = files.length; var numFiles = files.length;
var numToUpload = this.props.setUploads(numFiles); var numToUpload = this.props.setUploads(numFiles);
for (var i = 0; i < numFiles && i < numToUpload; i++) { for (var i = 0; i < numFiles && i < numToUpload; i++) {
var file = files[i]; var file = files[i];
var channelId = this.props.channelId || ChannelStore.getCurrentId();
var formData = new FormData(); var formData = new FormData();
formData.append('channel_id', channelId); formData.append('channel_id', channelId);

Просмотреть файл

@@ -124,6 +124,7 @@ module.exports = React.createClass({
$(this).parent('div').next('.date-separator, .new-separator').removeClass('hovered--comment'); $(this).parent('div').next('.date-separator, .new-separator').removeClass('hovered--comment');
} }
}); });
}, },
componentDidUpdate: function() { componentDidUpdate: function() {
this.resize(); this.resize();
@@ -461,11 +462,6 @@ module.exports = React.createClass({
postCtls.push(<LoadingScreen position="absolute" />); postCtls.push(<LoadingScreen position="absolute" />);
} }
var fileDragOverlay = '';
if (this.state.fileDrag) {
fileDragOverlay = 'post-list-file-overlay';
}
return ( return (
<div ref="postlist" className="post-list-holder-by-time"> <div ref="postlist" className="post-list-holder-by-time">
<div className="post-list__table"> <div className="post-list__table">

Просмотреть файл

@@ -294,13 +294,8 @@ module.exports = React.createClass({
var currentId = UserStore.getCurrentId(); var currentId = UserStore.getCurrentId();
var searchForm = currentId == null ? null : <SearchBox />; var searchForm = currentId == null ? null : <SearchBox />;
var fileDragOverlay = '';
if (this.state.fileDrag) {
fileDragOverlay = 'post-right-file-overlay';
}
return ( return (
<div className="post-right__container "> <div className="post-right__container">
<div className="search-bar__container sidebar--right__search-header">{searchForm}</div> <div className="search-bar__container sidebar--right__search-header">{searchForm}</div>
<div className="sidebar-right__body"> <div className="sidebar-right__body">
<RhsHeaderPost fromSearch={this.props.fromSearch} isMentionSearch={this.props.isMentionSearch} /> <RhsHeaderPost fromSearch={this.props.fromSearch} isMentionSearch={this.props.isMentionSearch} />

Просмотреть файл

@@ -204,13 +204,9 @@
} }
.center-file-overlay { .center-file-overlay {
width: 100%;
height: 100%;
background:rgba(255,255,255,0.5); background:rgba(255,255,255,0.5);
} }
.right-file-overlay { .right-file-overlay {
width: 100%;
height: 100%;
background:rgba(255,255,255,0.5); background:rgba(255,255,255,0.5);
} }

Просмотреть файл

@@ -107,11 +107,6 @@ body.ios {
} }
#post-list { #post-list {
.post-list-file-overlay {
width: 100%;
height: 100%;
background:rgba(255,255,255,0.5);
}
.post-list-holder-by-time { .post-list-holder-by-time {
background: #fff; background: #fff;
overflow-y: scroll; overflow-y: scroll;