From 34c948bed726fa4ebe097322b1dc0ed1285abc1e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 19 Jun 2019 23:06:24 -0400 Subject: [PATCH] hide claims if they are blocked --- src/ui/component/claimListItem/index.js | 2 ++ src/ui/component/claimListItem/view.jsx | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ui/component/claimListItem/index.js b/src/ui/component/claimListItem/index.js index b69db1d6c..371cb7ba1 100644 --- a/src/ui/component/claimListItem/index.js +++ b/src/ui/component/claimListItem/index.js @@ -9,6 +9,7 @@ import { makeSelectTitleForUri, makeSelectClaimIsNsfw, } from 'lbry-redux'; +import { selectBlackListedOutpoints } from 'lbryinc'; import { selectShowNsfw } from 'redux/selectors/settings'; import ClaimListItem from './view'; @@ -21,6 +22,7 @@ const select = (state, props) => ({ thumbnail: makeSelectThumbnailForUri(props.uri)(state), title: makeSelectTitleForUri(props.uri)(state), nsfw: makeSelectClaimIsNsfw(props.uri)(state), + blackListedOutpoints: selectBlackListedOutpoints(state), }); const perform = dispatch => ({ diff --git a/src/ui/component/claimListItem/view.jsx b/src/ui/component/claimListItem/view.jsx index bc2836ce6..cd0376f71 100644 --- a/src/ui/component/claimListItem/view.jsx +++ b/src/ui/component/claimListItem/view.jsx @@ -29,6 +29,10 @@ type Props = { nsfw: boolean, placeholder: boolean, type: string, + blackListedOutpoints: Array<{ + txid: string, + nout: number, + }>, }; function ClaimListItem(props: Props) { @@ -46,13 +50,23 @@ function ClaimListItem(props: Props) { claim, placeholder, type, + blackListedOutpoints, } = props; - const haventFetched = claim === undefined; const abandoned = !isResolvingUri && !claim; - const shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw); const isChannel = claim && claim.value_type === 'channel'; const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0; + let shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw); + + // This will be replaced once blocking is done at the wallet server level + if (claim && !shouldHide) { + for (let i = 0; i < blackListedOutpoints.length; i += 1) { + const outpoint = blackListedOutpoints[i]; + if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) { + shouldHide = true; + } + } + } function handleContextMenu(e) { e.preventDefault();