From d8c2770ac1e35eae8c874bd4c218de74b8bbfca1 Mon Sep 17 00:00:00 2001 From: zxawry Date: Thu, 29 Aug 2019 16:19:37 +0100 Subject: [PATCH] fix reselect video on publish edits --- src/ui/component/selectThumbnail/index.js | 2 ++ src/ui/component/selectThumbnail/view.jsx | 32 ++++++++++++++--------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/ui/component/selectThumbnail/index.js b/src/ui/component/selectThumbnail/index.js index e1eef354f..284a968f0 100644 --- a/src/ui/component/selectThumbnail/index.js +++ b/src/ui/component/selectThumbnail/index.js @@ -6,6 +6,7 @@ import { selectMyClaimForUri, selectIsResolvingPublishUris, selectTakeOverAmount, + selectFileInfosByOutpoint, doResetThumbnailStatus, doClearPublish, doUpdatePublishForm, @@ -25,6 +26,7 @@ const select = state => ({ myClaimForUri: selectMyClaimForUri(state), // If I clicked the "edit" button, have I changed the uri? // Need this to make it easier to find the source on previously published content + fileInfos: selectFileInfosByOutpoint(state), isStillEditing: selectIsStillEditing(state), isResolvingUri: selectIsResolvingPublishUris(state), totalRewardValue: selectUnclaimedRewardValue(state), diff --git a/src/ui/component/selectThumbnail/view.jsx b/src/ui/component/selectThumbnail/view.jsx index e49086b2a..17c4614ad 100644 --- a/src/ui/component/selectThumbnail/view.jsx +++ b/src/ui/component/selectThumbnail/view.jsx @@ -10,6 +10,8 @@ import ThumbnailBrokenImage from './thumbnail-broken.png'; type Props = { filePath: ?string, + fileInfos: { [string]: FileListItem }, + myClaimForUri: ?StreamClaim, thumbnail: ?string, formDisabled: boolean, uploadThumbnailStatus: string, @@ -52,6 +54,8 @@ class SelectThumbnail extends React.PureComponent { render() { const { filePath, + fileInfos, + myClaimForUri, thumbnail, formDisabled, uploadThumbnailStatus: status, @@ -63,7 +67,12 @@ class SelectThumbnail extends React.PureComponent { const { thumbnailError } = this.state; - const isSupportedVideo = Lbry.getMediaType(null, filePath) === 'video'; + const outpoint = myClaimForUri ? `${myClaimForUri.txid}:${myClaimForUri.nout}` : undefined; + const fileInfo = outpoint ? fileInfos[outpoint] : undefined; + const downloadPath = fileInfo ? fileInfo.download_path : undefined; + + const actualFilePath = filePath || downloadPath; + const isSupportedVideo = Lbry.getMediaType(null, actualFilePath) === 'video'; let thumbnailSrc; if (!thumbnail) { @@ -153,7 +162,7 @@ class SelectThumbnail extends React.PureComponent {