hide claims if they are blocked

This commit is contained in:
Sean Yesmunt 2019-06-19 23:06:24 -04:00
parent d035247b78
commit 34c948bed7
2 changed files with 18 additions and 2 deletions

View file

@ -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 => ({

View file

@ -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();