From ba4a29c1021a27f756827a200e4e3ac9ddd70eb5 Mon Sep 17 00:00:00 2001 From: zeppi Date: Thu, 25 Mar 2021 14:52:18 -0400 Subject: [PATCH] hide livestream claims in previews if no flag --- ui/component/claimPreview/index.js | 2 ++ ui/component/claimPreview/view.jsx | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/component/claimPreview/index.js b/ui/component/claimPreview/index.js index 753ca69cf..f0da24ab5 100644 --- a/ui/component/claimPreview/index.js +++ b/ui/component/claimPreview/index.js @@ -10,6 +10,7 @@ import { makeSelectReflectingClaimForUri, makeSelectClaimWasPurchased, makeSelectStreamingUrlForUri, + makeSelectClaimHasSource, } from 'lbry-redux'; import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; @@ -38,6 +39,7 @@ const select = (state, props) => ({ isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state), streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state), wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state), + isLivestream: !makeSelectClaimHasSource(props.uri)(state), }); const perform = (dispatch) => ({ diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index a595ba500..31dc7908f 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -24,6 +24,7 @@ import ClaimMenuList from 'component/claimMenuList'; import ClaimPreviewLoading from './claim-preview-loading'; import ClaimPreviewHidden from './claim-preview-no-mature'; import ClaimPreviewNoContent from './claim-preview-no-content'; +import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; type Props = { uri: string, @@ -68,6 +69,7 @@ type Props = { hideRepostLabel?: boolean, repostUrl?: string, hideMenu?: boolean, + isLivestream?: boolean, }; const ClaimPreview = forwardRef((props: Props, ref: any) => { @@ -117,6 +119,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { renderActions, hideMenu = false, // repostUrl, + isLivestream, } = props; const WrapperElement = wrapperElement || 'li'; const shouldFetch = @@ -201,7 +204,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { } }, [isValid, uri, isResolvingUri, shouldFetch, resolveUri]); - if (shouldHide && !showNullPlaceholder) { + if ((shouldHide && !showNullPlaceholder) || (isLivestream && !ENABLE_NO_SOURCE_CLAIMS)) { return null; }