disable video thumbnail edits; remove console logs

This commit is contained in:
Travis Eden 2018-11-08 14:05:06 -05:00
parent e970bb9e0d
commit 0fa9bc831e
5 changed files with 58 additions and 66 deletions

View file

@ -12,7 +12,6 @@ class PublishPreview extends React.Component {
componentDidMount () { componentDidMount () {
const { isUpdate, sourceUrl, file } = this.props; const { isUpdate, sourceUrl, file } = this.props;
if (isUpdate && sourceUrl) { if (isUpdate && sourceUrl) {
console.log('setting sourceUrl:', sourceUrl);
this.setState({ imgSource: sourceUrl }); this.setState({ imgSource: sourceUrl });
} else { } else {
this.setPreviewImageSource(file); this.setPreviewImageSource(file);

View file

@ -85,63 +85,66 @@ class Dropzone extends React.Component {
const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props; const { file, thumbnail, fileError, isUpdate, sourceUrl, fileExt } = this.props;
return ( return (
<div> <div>
{isUpdate && fileExt === 'mp4' && (<p>Video thumbnail:</p>)} {isUpdate && fileExt === 'mp4' ? (
<div className='dropzone-wrapper'> <p>Video updates are currently disabled. This feature will be available soon. You can edit metadata.</p>
<form> ) : (
<input <div className='dropzone-wrapper'>
className='input-file' <form>
type='file' <input
id='file_input' className='input-file'
name='file_input' type='file'
accept='video/*,image/*' id='file_input'
onChange={this.handleFileInput} name='file_input'
encType='multipart/form-data' accept='video/*,image/*'
/> onChange={this.handleFileInput}
</form> encType='multipart/form-data'
<div />
className={'dropzone' + (dragOver ? ' dropzone--drag-over' : '')} </form>
onDrop={this.handleDrop} <div
onDragOver={this.handleDragOver} className={'dropzone' + (dragOver ? ' dropzone--drag-over' : '')}
onDragEnd={this.handleDragEnd} onDrop={this.handleDrop}
onDragEnter={this.handleDragEnter} onDragOver={this.handleDragOver}
onDragLeave={this.handleDragLeave} onDragEnd={this.handleDragEnd}
onMouseEnter={this.handleMouseEnter} onDragEnter={this.handleDragEnter}
onMouseLeave={this.handleMouseLeave} onDragLeave={this.handleDragLeave}
onClick={this.handleClick}> onMouseEnter={this.handleMouseEnter}
{file || isUpdate ? ( onMouseLeave={this.handleMouseLeave}
<div className={'dropzone-preview-wrapper'}> onClick={this.handleClick}>
{file ? ( {file || isUpdate ? (
<DropzonePreviewImage <div className={'dropzone-preview-wrapper'}>
dimPreview={dimPreview} {file ? (
file={file} <DropzonePreviewImage
thumbnail={thumbnail} dimPreview={dimPreview}
/> file={file}
) : ( thumbnail={thumbnail}
<DropzonePreviewImage
dimPreview
isUpdate
sourceUrl={sourceUrl}
/>
)}
<div className={'dropzone-preview-overlay'}>
{ dragOver ? <DropzoneDropItDisplay /> : null }
{ mouseOver ? (
<DropzoneInstructionsDisplay
fileError={fileError}
message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null}
/> />
) : null } ) : (
<DropzonePreviewImage
dimPreview
isUpdate
sourceUrl={sourceUrl}
/>
)}
<div className={'dropzone-preview-overlay'}>
{ dragOver ? <DropzoneDropItDisplay /> : null }
{ mouseOver ? (
<DropzoneInstructionsDisplay
fileError={fileError}
message={fileExt === 'mp4' ? 'Drag & drop new thumbnail' : null}
/>
) : null }
</div>
</div> </div>
</div> ) : (
) : ( dragOver ? <DropzoneDropItDisplay /> : (
dragOver ? <DropzoneDropItDisplay /> : ( <DropzoneInstructionsDisplay
<DropzoneInstructionsDisplay fileError={fileError}
fileError={fileError} />
/> )
) )}
)} </div>
</div> </div>
</div> )}
</div> </div>
); );
} }

View file

@ -40,10 +40,6 @@ const publish = async (publishParams, fileName, fileType) => {
fileRecord = await db.File.findOne({where: {claimId}}).then(result => result.dataValues); fileRecord = await db.File.findOne({where: {claimId}}).then(result => result.dataValues);
} }
logger.info('fileRecord:', fileRecord);
logger.info('claimRecord:', claimRecord);
logger.info('upsertCriteria:', upsertCriteria);
const [file, claim] = await Promise.all([ const [file, claim] = await Promise.all([
db.upsert(db.File, fileRecord, upsertCriteria, 'File'), db.upsert(db.File, fileRecord, upsertCriteria, 'File'),
db.upsert(db.Claim, claimRecord, upsertCriteria, 'Claim'), db.upsert(db.Claim, claimRecord, upsertCriteria, 'Claim'),

View file

@ -96,7 +96,6 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
if (claimRecord.content_type === 'video/mp4' && files.file) { if (claimRecord.content_type === 'video/mp4' && files.file) {
thumbnailUpdate = true; thumbnailUpdate = true;
} }
logger.info('claimRecord:', claimRecord);
if (!files.file || thumbnailUpdate) { if (!files.file || thumbnailUpdate) {
return Promise.all([ return Promise.all([
@ -132,7 +131,6 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
const newThumbnailName = `${name}-${rando()}`; const newThumbnailName = `${name}-${rando()}`;
const newThumbnailParams = createThumbnailPublishParams(filePath, newThumbnailName, license, nsfw); const newThumbnailParams = createThumbnailPublishParams(filePath, newThumbnailName, license, nsfw);
newThumbnailParams['file_path'] = filePath; newThumbnailParams['file_path'] = filePath;
logger.info('newThumbnailParams:', newThumbnailParams);
publish(newThumbnailParams, fileName, fileType); publish(newThumbnailParams, fileName, fileType);
publishParams['sources'] = resolution.claim.value.stream.source; publishParams['sources'] = resolution.claim.value.stream.source;

View file

@ -47,7 +47,7 @@ async function createFileRecordDataAfterPublish (fileName, fileType, publishPara
width: fileWidth, width: fileWidth,
} = await getMediaDimensions(fileType, filePath); } = await getMediaDimensions(fileType, filePath);
const obj = { return {
name, name,
claimId, claimId,
outpoint: `${txid}:${nout}`, outpoint: `${txid}:${nout}`,
@ -57,10 +57,6 @@ async function createFileRecordDataAfterPublish (fileName, fileType, publishPara
filePath, filePath,
fileType, fileType,
}; };
console.log('createFileRecordDataAfterPublish return:', obj);
return obj;
} }
module.exports = { module.exports = {