From 63b19a92aaeec8cafdc2175c5314970cd0197bc0 Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Wed, 31 Aug 2022 15:20:03 -0300 Subject: [PATCH] Remove blacklist. --- extras/lbryinc/index.js | 4 --- extras/lbryinc/redux/selectors/blacklist.js | 20 ----------- ui/component/previewLink/index.js | 2 -- ui/redux/selectors/claims.js | 40 +++++++-------------- 4 files changed, 13 insertions(+), 53 deletions(-) delete mode 100644 extras/lbryinc/redux/selectors/blacklist.js diff --git a/extras/lbryinc/index.js b/extras/lbryinc/index.js index 4adeef98d..267ab39d2 100644 --- a/extras/lbryinc/index.js +++ b/extras/lbryinc/index.js @@ -39,10 +39,6 @@ export { selectAllCostInfoByUri, selectFetchingCostInfo, } from './redux/selectors/cost_info'; -export { - selectBlackListedOutpoints, - selectBlacklistedOutpointMap, -} from './redux/selectors/blacklist'; export { selectViewCount, selectViewCountForUri, diff --git a/extras/lbryinc/redux/selectors/blacklist.js b/extras/lbryinc/redux/selectors/blacklist.js deleted file mode 100644 index ed0d8ccb1..000000000 --- a/extras/lbryinc/redux/selectors/blacklist.js +++ /dev/null @@ -1,20 +0,0 @@ -import { createSelector } from 'reselect'; - -export const selectState = state => state.blacklist || {}; - -export const selectBlackListedOutpoints = createSelector( - selectState, - state => state.blackListedOutpoints -); - -export const selectBlacklistedOutpointMap = createSelector( - selectBlackListedOutpoints, - outpoints => - outpoints - ? outpoints.reduce((acc, val) => { - const outpoint = `${val.txid}:${val.nout}`; - acc[outpoint] = 1; - return acc; - }, {}) - : {} -); diff --git a/ui/component/previewLink/index.js b/ui/component/previewLink/index.js index 1df8f7807..2cba36f21 100644 --- a/ui/component/previewLink/index.js +++ b/ui/component/previewLink/index.js @@ -8,7 +8,6 @@ import { makeSelectMetadataItemForUri, } from 'redux/selectors/claims'; import { doResolveUri } from 'redux/actions/claims'; -import { selectBlackListedOutpoints } from 'lbryinc'; import PreviewLink from './view'; const select = (state, props) => { @@ -22,7 +21,6 @@ const select = (state, props) => { description: makeSelectMetadataItemForUri(props.uri, 'description')(state), channelIsMine: selectClaimIsMine(state, claim), isResolvingUri: selectIsUriResolving(state, props.uri), - blackListedOutpoints: selectBlackListedOutpoints(state), }; }; diff --git a/ui/redux/selectors/claims.js b/ui/redux/selectors/claims.js index b558954d1..1f13f1bb9 100644 --- a/ui/redux/selectors/claims.js +++ b/ui/redux/selectors/claims.js @@ -4,7 +4,6 @@ import { selectSupportsByOutpoint } from 'redux/selectors/wallet'; import { createSelector } from 'reselect'; import { createCachedSelector } from 're-reselect'; import { isClaimNsfw, filterClaims } from 'util/claim'; -import { selectBlackListedOutpoints } from 'lbryinc'; import * as CLAIM from 'constants/claim'; type State = { claims: any }; @@ -96,33 +95,20 @@ export const makeSelectClaimErrorCensor = (claimUri: string) => createSelector(selectState, (state) => state.blacklistedByUri[claimUri]); export const makeSelectIsBlacklisted = (claimUri: string) => - createSelector( - makeSelectClaimErrorCensor(claimUri), - selectBlackListedOutpoints, - makeSelectClaimForUri(claimUri), - (errorCensor, legacyBlacklistedList, claim) => { - if (errorCensor) { - return true; - } - // Fallback to legacy just in case. - if (!claim) { - return false; - } - if (!legacyBlacklistedList) { - return false; - } - const signingChannel = claim.signing_channel; - if (!signingChannel) { - return false; - } - const isInLegacyBlacklist = legacyBlacklistedList.some( - (outpoint) => - (signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) || - (outpoint.txid === claim.txid && outpoint.nout === claim.nout) - ); - return isInLegacyBlacklist; + createSelector(makeSelectClaimErrorCensor(claimUri), makeSelectClaimForUri(claimUri), (errorCensor, claim) => { + if (errorCensor) { + return true; } - ); + // Fallback to legacy just in case. + if (!claim) { + return false; + } + const signingChannel = claim.signing_channel; + if (!signingChannel) { + return false; + } + return false; + }); export const makeSelectClaimForClaimId = (claimId: string) => createSelector(selectClaimsById, (byId) => byId[claimId]);