block channels on homepage

This commit is contained in:
Sean Yesmunt 2020-01-20 13:55:28 -05:00
parent dea9cc0661
commit be84f73387
3 changed files with 17 additions and 2 deletions

View file

@ -906,5 +906,7 @@
"This Year": "This Year",
"Khmer": "Khmer",
"Invites": "Invites",
"This is an experiment, and may be removed in the future. Publish something with the #homepagecagematch tag to battle for the top spot on the home page!": "This is an experiment, and may be removed in the future. Publish something with the #homepagecagematch tag to battle for the top spot on the home page!"
"This is an experiment, and may be removed in the future. Publish something with the #homepagecagematch tag to battle for the top spot on the home page!": "This is an experiment, and may be removed in the future. Publish something with the #homepagecagematch tag to battle for the top spot on the home page!",
"%claimsInChannel% publishes": "%claimsInChannel% publishes",
"%claimsInChannel% publish": "%claimsInChannel% publish"
}

View file

@ -7,6 +7,7 @@ import {
makeSelectTitleForUri,
doFileGet,
makeSelectChannelForClaimUri,
selectBlockedChannels,
} from 'lbry-redux';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import ClaimPreviewTile from './view';
@ -19,6 +20,7 @@ const select = (state, props) => ({
title: props.uri && makeSelectTitleForUri(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
filteredOutpoints: selectFilteredOutpoints(state),
blockedChannelUris: selectBlockedChannels(state),
});
const perform = dispatch => ({

View file

@ -49,6 +49,7 @@ function ClaimPreviewTile(props: Props) {
filteredOutpoints,
getFile,
streamingUrl,
blockedChannelUris,
} = props;
const shouldFetch = claim === undefined;
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, placeholder) || thumbnail;
@ -107,6 +108,16 @@ function ClaimPreviewTile(props: Props) {
);
}
// block stream claims
if (claim && !shouldHide && blockedChannelUris.length && signingChannel) {
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === signingChannel.permanent_url);
}
// block channel claims if we can't control for them in claim search
// e.g. fetchRecommendedSubscriptions
if (claim && isChannel && !shouldHide && blockedChannelUris.length) {
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === claim.permanent_url);
}
if (shouldHide) {
return null;
}
@ -136,7 +147,7 @@ function ClaimPreviewTile(props: Props) {
</NavLink>
<NavLink to={navigateUrl}>
<h2 className="claim-tile__title">
<TruncatedText text={title} lines={2} />
<TruncatedText text={title || (claim && claim.name)} lines={2} />
</h2>
</NavLink>
<div className="claim-tile__info">