Discovery fixes #2576
2 changed files with 18 additions and 2 deletions
|
@ -9,6 +9,7 @@ import {
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectClaimIsNsfw,
|
makeSelectClaimIsNsfw,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import ClaimListItem from './view';
|
import ClaimListItem from './view';
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ const select = (state, props) => ({
|
||||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: makeSelectTitleForUri(props.uri)(state),
|
||||||
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
||||||
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|
|
@ -29,6 +29,10 @@ type Props = {
|
||||||
nsfw: boolean,
|
nsfw: boolean,
|
||||||
placeholder: boolean,
|
placeholder: boolean,
|
||||||
type: string,
|
type: string,
|
||||||
|
blackListedOutpoints: Array<{
|
||||||
|
txid: string,
|
||||||
|
nout: number,
|
||||||
|
}>,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ClaimListItem(props: Props) {
|
function ClaimListItem(props: Props) {
|
||||||
|
@ -46,13 +50,23 @@ function ClaimListItem(props: Props) {
|
||||||
claim,
|
claim,
|
||||||
placeholder,
|
placeholder,
|
||||||
type,
|
type,
|
||||||
|
blackListedOutpoints,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const haventFetched = claim === undefined;
|
const haventFetched = claim === undefined;
|
||||||
const abandoned = !isResolvingUri && !claim;
|
const abandoned = !isResolvingUri && !claim;
|
||||||
const shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw);
|
|
||||||
const isChannel = claim && claim.value_type === 'channel';
|
const isChannel = claim && claim.value_type === 'channel';
|
||||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
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) {
|
function handleContextMenu(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
Loading…
Reference in a new issue