Filter preview (#2621)
* discovery previews use filter api * updates lbryinc * refactor
This commit is contained in:
parent
04e53ecda1
commit
112ffe6696
5 changed files with 32 additions and 11 deletions
|
@ -125,7 +125,7 @@
|
|||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#bb82aed61a5569e565daa784eb25fc1d639c0c22",
|
||||
"lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845",
|
||||
"lbryinc": "lbryio/lbryinc#69f9562b016030b481375443f56147ff5e273c0e",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
"lodash-es": "^4.17.14",
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
makeSelectTitleForUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
} from 'lbry-redux';
|
||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import ClaimPreview from './view';
|
||||
|
||||
|
@ -23,6 +23,7 @@ const select = (state, props) => ({
|
|||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
|
|
@ -33,6 +33,10 @@ type Props = {
|
|||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
filteredOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
};
|
||||
|
||||
function ClaimPreview(props: Props) {
|
||||
|
@ -51,6 +55,7 @@ function ClaimPreview(props: Props) {
|
|||
placeholder,
|
||||
type,
|
||||
blackListedOutpoints,
|
||||
filteredOutpoints,
|
||||
} = props;
|
||||
const haventFetched = claim === undefined;
|
||||
const abandoned = !isResolvingUri && !claim && !placeholder;
|
||||
|
@ -60,14 +65,13 @@ function ClaimPreview(props: Props) {
|
|||
let shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw);
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level
|
||||
|
||||
if (claim && !shouldHide && blackListedOutpoints) {
|
||||
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
|
||||
const outpoint = blackListedOutpoints[i];
|
||||
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
|
||||
shouldHide = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
shouldHide = blackListedOutpoints.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||
}
|
||||
|
||||
if (claim && !shouldHide && filteredOutpoints) {
|
||||
shouldHide = filteredOutpoints.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||
}
|
||||
|
||||
function handleContextMenu(e) {
|
||||
|
|
|
@ -14,7 +14,13 @@ import { Provider } from 'react-redux';
|
|||
import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate, doOpenModal, doHideModal } from 'redux/actions/app';
|
||||
import { Lbry, doToast, isURIValid, setSearchApi } from 'lbry-redux';
|
||||
import { doInitLanguage, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||
import { doAuthenticate, Lbryio, rewards, doBlackListedOutpointsSubscribe } from 'lbryinc';
|
||||
import {
|
||||
doAuthenticate,
|
||||
Lbryio,
|
||||
rewards,
|
||||
doBlackListedOutpointsSubscribe,
|
||||
doFilteredOutpointsSubscribe,
|
||||
} from 'lbryinc';
|
||||
import { store, history } from 'store';
|
||||
import pjson from 'package.json';
|
||||
import app from './app';
|
||||
|
@ -216,6 +222,7 @@ const init = () => {
|
|||
|
||||
app.store.dispatch(doInitLanguage());
|
||||
app.store.dispatch(doBlackListedOutpointsSubscribe());
|
||||
app.store.dispatch(doFilteredOutpointsSubscribe());
|
||||
|
||||
function onDaemonReady() {
|
||||
// @if TARGET='app'
|
||||
|
|
|
@ -9,7 +9,15 @@ import {
|
|||
tagsReducer,
|
||||
commentReducer,
|
||||
} from 'lbry-redux';
|
||||
import { userReducer, rewardsReducer, costInfoReducer, blacklistReducer, homepageReducer, statsReducer } from 'lbryinc';
|
||||
import {
|
||||
userReducer,
|
||||
rewardsReducer,
|
||||
costInfoReducer,
|
||||
blacklistReducer,
|
||||
filteredReducer,
|
||||
homepageReducer,
|
||||
statsReducer,
|
||||
} from 'lbryinc';
|
||||
import appReducer from 'redux/reducers/app';
|
||||
import availabilityReducer from 'redux/reducers/availability';
|
||||
import contentReducer from 'redux/reducers/content';
|
||||
|
@ -23,6 +31,7 @@ export default history =>
|
|||
app: appReducer,
|
||||
availability: availabilityReducer,
|
||||
blacklist: blacklistReducer,
|
||||
filtered: filteredReducer,
|
||||
claims: claimsReducer,
|
||||
comments: commentReducer,
|
||||
content: contentReducer,
|
||||
|
|
Loading…
Reference in a new issue