From 9d1cf97aeff030fe7b96983b80e2eaef10d885ad Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 2 Apr 2021 11:39:05 +0800 Subject: [PATCH] Use blank poster and advisory when preview is blocked by insufficient stake. ## Issue - Redo 5636: Disable video previews in comments/posts made by channels below a certain channel staked level - Closes 5738: expand video preview level requierment to markdown images also --- ui/component/claimLink/view.jsx | 36 ++++++++++++++++++++---- ui/component/embedPlayButton/view.jsx | 16 +++++++---- ui/component/markdownLink/view.jsx | 15 ++-------- ui/scss/component/_markdown-preview.scss | 7 +++++ 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/ui/component/claimLink/view.jsx b/ui/component/claimLink/view.jsx index f2fe09726..d999cd028 100644 --- a/ui/component/claimLink/view.jsx +++ b/ui/component/claimLink/view.jsx @@ -5,6 +5,7 @@ import EmbedPlayButton from 'component/embedPlayButton'; import Button from 'component/button'; import UriIndicator from 'component/uriIndicator'; import { INLINE_PLAYER_WRAPPER_CLASS } from 'component/fileRenderFloating/view'; +import { SIMPLE_SITE } from 'config'; type Props = { uri: string, @@ -12,7 +13,7 @@ type Props = { children: React.Node, description: ?string, isResolvingUri: boolean, - doResolveUri: string => void, + doResolveUri: (string) => void, blackListedOutpoints: Array<{ txid: string, nout: number, @@ -20,6 +21,7 @@ type Props = { playingUri: ?PlayingUri, parentCommentId?: string, isMarkdownPost?: boolean, + allowPreview?: boolean, }; class ClaimLink extends React.Component { @@ -46,7 +48,7 @@ class ClaimLink extends React.Component { let blackListed = false; blackListed = blackListedOutpoints.some( - outpoint => + (outpoint) => (signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) || (outpoint.txid === claim.txid && outpoint.nout === claim.nout) ); @@ -63,7 +65,16 @@ class ClaimLink extends React.Component { }; render() { - const { uri, claim, children, isResolvingUri, playingUri, parentCommentId, isMarkdownPost } = this.props; + const { + uri, + claim, + children, + isResolvingUri, + playingUri, + parentCommentId, + isMarkdownPost, + allowPreview, + } = this.props; const isUnresolved = (!isResolvingUri && !claim) || !claim; const isBlacklisted = this.isClaimBlackListed(); const isPlayingInline = @@ -88,9 +99,24 @@ class ClaimLink extends React.Component { [INLINE_PLAYER_WRAPPER_CLASS]: isPlayingInline, })} > - + -