always use thumbnail from claim if it exists on web

This commit is contained in:
Sean Yesmunt 2020-06-02 12:44:14 -04:00
parent a0ace5ca58
commit 48eac1188f
3 changed files with 5 additions and 6 deletions

View file

@ -5,7 +5,6 @@ import {
makeSelectIsUriResolving,
makeSelectClaimIsMine,
makeSelectClaimIsPending,
makeSelectThumbnailForUri,
makeSelectCoverForUri,
makeSelectClaimIsNsfw,
selectBlockedChannels,
@ -28,7 +27,6 @@ const select = (state, props) => ({
obscureNsfw: !selectShowMatureContent(state),
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
cover: props.uri && makeSelectCoverForUri(props.uri)(state),
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),

View file

@ -34,7 +34,6 @@ type Props = {
resolveUri: string => void,
isResolvingUri: boolean,
history: { push: string => void },
thumbnail: string,
title: string,
nsfw: boolean,
placeholder: string,
@ -71,7 +70,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
history,
uri,
isResolvingUri,
thumbnail,
nsfw,
resolveUri,
claim,
@ -159,7 +157,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// Weird placement warning
// Make sure this happens after we figure out if this claim needs to be hidden
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide) || thumbnail;
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide);
function handleContextMenu(e) {
// @if TARGET='app'

View file

@ -18,7 +18,10 @@ export default function useGetThumbnail(
let thumbnailToUse;
// @if TARGET='web'
if (claim && isImage && isFree) {
const thumbnailInClaim = claim && claim.value && claim.value.thumbnail && claim.value.thumbnail.url;
if (thumbnailInClaim) {
thumbnailToUse = thumbnailInClaim;
} else if (claim && isImage && isFree) {
thumbnailToUse = generateStreamUrl(claim.name, claim.claim_id);
}
// @endif