From be84f73387f68d49b67bd57cd3c9bf5a7d381717 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 20 Jan 2020 13:55:28 -0500 Subject: [PATCH] block channels on homepage --- static/app-strings.json | 4 +++- ui/component/claimPreviewTile/index.js | 2 ++ ui/component/claimPreviewTile/view.jsx | 13 ++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 5eb653f57..00d8d3ccf 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -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" } \ No newline at end of file diff --git a/ui/component/claimPreviewTile/index.js b/ui/component/claimPreviewTile/index.js index a3b85dde4..056b849b3 100644 --- a/ui/component/claimPreviewTile/index.js +++ b/ui/component/claimPreviewTile/index.js @@ -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 => ({ diff --git a/ui/component/claimPreviewTile/view.jsx b/ui/component/claimPreviewTile/view.jsx index eb0da0d83..242f81906 100644 --- a/ui/component/claimPreviewTile/view.jsx +++ b/ui/component/claimPreviewTile/view.jsx @@ -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) {

- +