Discovery fixes #2576

Merged
neb-b merged 10 commits from discovery-fixes into master 2019-06-28 09:27:56 +02:00
2 changed files with 18 additions and 2 deletions
Showing only changes of commit 34c948bed7 - Show all commits

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