Remove blocked and filtered reducers/selectors/actions. #7682

Open
Ruk33 wants to merge 9 commits from 7681-remove-block-list-apis into master
26 changed files with 103 additions and 399 deletions

View file

@ -50,18 +50,6 @@ export const GET_SUGGESTED_SUBSCRIPTIONS_FAIL = 'GET_SUGGESTED_SUBSCRIPTIONS_FAI
export const SUBSCRIPTION_FIRST_RUN_COMPLETED = 'SUBSCRIPTION_FIRST_RUN_COMPLETED'; export const SUBSCRIPTION_FIRST_RUN_COMPLETED = 'SUBSCRIPTION_FIRST_RUN_COMPLETED';
export const VIEW_SUGGESTED_SUBSCRIPTIONS = 'VIEW_SUGGESTED_SUBSCRIPTIONS'; export const VIEW_SUGGESTED_SUBSCRIPTIONS = 'VIEW_SUGGESTED_SUBSCRIPTIONS';
// Blacklist
export const FETCH_BLACK_LISTED_CONTENT_STARTED = 'FETCH_BLACK_LISTED_CONTENT_STARTED';
export const FETCH_BLACK_LISTED_CONTENT_COMPLETED = 'FETCH_BLACK_LISTED_CONTENT_COMPLETED';
export const FETCH_BLACK_LISTED_CONTENT_FAILED = 'FETCH_BLACK_LISTED_CONTENT_FAILED';
export const BLACK_LISTED_CONTENT_SUBSCRIBE = 'BLACK_LISTED_CONTENT_SUBSCRIBE';
// Filtered list
export const FETCH_FILTERED_CONTENT_STARTED = 'FETCH_FILTERED_CONTENT_STARTED';
export const FETCH_FILTERED_CONTENT_COMPLETED = 'FETCH_FILTERED_CONTENT_COMPLETED';
export const FETCH_FILTERED_CONTENT_FAILED = 'FETCH_FILTERED_CONTENT_FAILED';
export const FILTERED_CONTENT_SUBSCRIBE = 'FILTERED_CONTENT_SUBSCRIBE';
// Cost Info // Cost Info
export const FETCH_COST_INFO_STARTED = 'FETCH_COST_INFO_STARTED'; export const FETCH_COST_INFO_STARTED = 'FETCH_COST_INFO_STARTED';
export const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED'; export const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED';

View file

@ -14,8 +14,6 @@ export { doTransifexUpload } from 'util/transifex-upload';
// actions // actions
export { doGenerateAuthToken } from './redux/actions/auth'; export { doGenerateAuthToken } from './redux/actions/auth';
export { doFetchCostInfoForUri } from './redux/actions/cost_info'; export { doFetchCostInfoForUri } from './redux/actions/cost_info';
export { doBlackListedOutpointsSubscribe } from './redux/actions/blacklist';
export { doFilteredOutpointsSubscribe } from './redux/actions/filtered';
export { doFetchViewCount, doFetchSubCount } from './redux/actions/stats'; export { doFetchViewCount, doFetchSubCount } from './redux/actions/stats';
export { export {
doCheckSync, doCheckSync,
@ -30,8 +28,6 @@ export {
// reducers // reducers
export { authReducer } from './redux/reducers/auth'; export { authReducer } from './redux/reducers/auth';
export { costInfoReducer } from './redux/reducers/cost_info'; export { costInfoReducer } from './redux/reducers/cost_info';
export { blacklistReducer } from './redux/reducers/blacklist';
export { filteredReducer } from './redux/reducers/filtered';
export { statsReducer } from './redux/reducers/stats'; export { statsReducer } from './redux/reducers/stats';
export { syncReducer } from './redux/reducers/sync'; export { syncReducer } from './redux/reducers/sync';
@ -43,17 +39,10 @@ export {
selectAllCostInfoByUri, selectAllCostInfoByUri,
selectFetchingCostInfo, selectFetchingCostInfo,
} from './redux/selectors/cost_info'; } from './redux/selectors/cost_info';
export {
selectBlackListedOutpoints,
selectBlacklistedOutpointMap,
} from './redux/selectors/blacklist';
export { selectFilteredOutpoints, selectFilteredOutpointMap } from './redux/selectors/filtered';
export { export {
selectViewCount, selectViewCount,
selectViewCountForUri, selectViewCountForUri,
// makeSelectViewCountForUri, // deprecated
selectSubCountForUri, selectSubCountForUri,
// makeSelectSubCountForUri, // deprecated
} from './redux/selectors/stats'; } from './redux/selectors/stats';
export { selectBanStateForUri } from './redux/selectors/ban'; export { selectBanStateForUri } from './redux/selectors/ban';
export { export {

View file

@ -1,52 +0,0 @@
import { Lbryio } from 'lbryinc';
import * as ACTIONS from 'constants/action_types';
const CHECK_BLACK_LISTED_CONTENT_INTERVAL = 60 * 60 * 1000;
export function doFetchBlackListedOutpoints() {
return dispatch => {
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_STARTED,
});
const success = ({ outpoints }) => {
const splitOutpoints = [];
if (outpoints) {
outpoints.forEach((outpoint, index) => {
const [txid, nout] = outpoint.split(':');
splitOutpoints[index] = { txid, nout: Number.parseInt(nout, 10) };
});
}
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_COMPLETED,
data: {
outpoints: splitOutpoints,
success: true,
},
});
};
const failure = ({ message: error }) => {
dispatch({
type: ACTIONS.FETCH_BLACK_LISTED_CONTENT_FAILED,
data: {
error,
success: false,
},
});
};
Lbryio.call('file', 'list_blocked', {
auth_token: '',
}).then(success, failure);
};
}
export function doBlackListedOutpointsSubscribe() {
return dispatch => {
dispatch(doFetchBlackListedOutpoints());
setInterval(() => dispatch(doFetchBlackListedOutpoints()), CHECK_BLACK_LISTED_CONTENT_INTERVAL);
};
}

View file

@ -1,47 +0,0 @@
import { Lbryio } from 'lbryinc';
import * as ACTIONS from 'constants/action_types';
const CHECK_FILTERED_CONTENT_INTERVAL = 60 * 60 * 1000;
export function doFetchFilteredOutpoints() {
return dispatch => {
dispatch({
type: ACTIONS.FETCH_FILTERED_CONTENT_STARTED,
});
const success = ({ outpoints }) => {
let formattedOutpoints = [];
if (outpoints) {
formattedOutpoints = outpoints.map(outpoint => {
const [txid, nout] = outpoint.split(':');
return { txid, nout: Number.parseInt(nout, 10) };
});
}
dispatch({
type: ACTIONS.FETCH_FILTERED_CONTENT_COMPLETED,
data: {
outpoints: formattedOutpoints,
},
});
};
const failure = ({ error }) => {
dispatch({
type: ACTIONS.FETCH_FILTERED_CONTENT_FAILED,
data: {
error,
},
});
};
Lbryio.call('file', 'list_filtered', { auth_token: '' }).then(success, failure);
};
}
export function doFilteredOutpointsSubscribe() {
return dispatch => {
dispatch(doFetchFilteredOutpoints());
setInterval(() => dispatch(doFetchFilteredOutpoints()), CHECK_FILTERED_CONTENT_INTERVAL);
};
}

View file

@ -1,37 +0,0 @@
import * as ACTIONS from 'constants/action_types';
import { handleActions } from 'util/redux-utils';
const defaultState = {
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: undefined,
blackListedOutpoints: undefined,
};
export const blacklistReducer = handleActions(
{
[ACTIONS.FETCH_BLACK_LISTED_CONTENT_STARTED]: state => ({
...state,
fetchingBlackListedOutpoints: true,
}),
[ACTIONS.FETCH_BLACK_LISTED_CONTENT_COMPLETED]: (state, action) => {
const { outpoints, success } = action.data;
return {
...state,
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: success,
blackListedOutpoints: outpoints,
};
},
[ACTIONS.FETCH_BLACK_LISTED_CONTENT_FAILED]: (state, action) => {
const { error, success } = action.data;
return {
...state,
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: success,
fetchingBlackListedOutpointsError: error,
};
},
},
defaultState
);

View file

@ -1,34 +0,0 @@
import * as ACTIONS from 'constants/action_types';
import { handleActions } from 'util/redux-utils';
const defaultState = {
loading: false,
filteredOutpoints: undefined,
};
export const filteredReducer = handleActions(
{
[ACTIONS.FETCH_FILTERED_CONTENT_STARTED]: state => ({
...state,
loading: true,
}),
[ACTIONS.FETCH_FILTERED_CONTENT_COMPLETED]: (state, action) => {
const { outpoints } = action.data;
return {
...state,
loading: false,
filteredOutpoints: outpoints,
};
},
[ACTIONS.FETCH_FILTERED_CONTENT_FAILED]: (state, action) => {
const { error } = action.data;
return {
...state,
loading: false,
fetchingFilteredOutpointsError: error,
};
},
},
defaultState
);

View file

@ -8,18 +8,15 @@ import { createCachedSelector } from 're-reselect';
import { selectClaimForUri, makeSelectIsBlacklisted } from 'redux/selectors/claims'; import { selectClaimForUri, makeSelectIsBlacklisted } from 'redux/selectors/claims';
import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectModerationBlockList } from 'redux/selectors/comments'; import { selectModerationBlockList } from 'redux/selectors/comments';
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
import { getChannelFromClaim } from 'util/claim'; import { getChannelFromClaim } from 'util/claim';
import { isURIEqual } from 'util/lbryURI'; import { isURIEqual } from 'util/lbryURI';
export const selectBanStateForUri = createCachedSelector( export const selectBanStateForUri = createCachedSelector(
selectClaimForUri, selectClaimForUri,
selectBlacklistedOutpointMap,
selectFilteredOutpointMap,
selectMutedChannels, selectMutedChannels,
selectModerationBlockList, selectModerationBlockList,
(state, uri) => makeSelectIsBlacklisted(uri)(state), (state, uri) => makeSelectIsBlacklisted(uri)(state),
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist, isBlacklisted) => { (claim, mutedChannelUris, personalBlocklist, isBlacklisted) => {
const banState = {}; const banState = {};
if (!claim) { if (!claim) {
@ -32,27 +29,6 @@ export const selectBanStateForUri = createCachedSelector(
banState['blacklisted'] = true; banState['blacklisted'] = true;
} }
// This will be replaced once blocking is done at the wallet server level.
if (blackListedOutpointMap) {
if (
(channelClaim && blackListedOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
blackListedOutpointMap[`${claim.txid}:${claim.nout}`]
) {
banState['blacklisted'] = true;
}
}
// We're checking to see if the stream outpoint or signing channel outpoint
// is in the filter list.
if (filteredOutpointMap) {
if (
(channelClaim && filteredOutpointMap[`${channelClaim.txid}:${channelClaim.nout}`]) ||
filteredOutpointMap[`${claim.txid}:${claim.nout}`]
) {
banState['filtered'] = true;
}
}
// block stream claims // block stream claims
// block channel claims if we can't control for them in claim search // block channel claims if we can't control for them in claim search
if (mutedChannelUris.length && channelClaim) { if (mutedChannelUris.length && channelClaim) {

View file

@ -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;
}, {})
: {}
);

View file

@ -1,20 +0,0 @@
import { createSelector } from 'reselect';
export const selectState = state => state.filtered || {};
export const selectFilteredOutpoints = createSelector(
selectState,
state => state.filteredOutpoints
);
export const selectFilteredOutpointMap = createSelector(
selectFilteredOutpoints,
outpoints =>
outpoints
? outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
acc[outpoint] = 1;
return acc;
}, {})
: {}
);

1
flow-typed/Claim.js vendored
View file

@ -167,6 +167,7 @@ declare type ClaimErrorCensor = {
take_over_height: number, take_over_height: number,
}, },
name: string, name: string,
text: string,
jessopb commented 2022-08-31 22:21:28 +02:00 (Migrated from github.com)
Review

+1

+1
normalized_name: string, normalized_name: string,
nout: number, nout: number,
permanent_url: string, permanent_url: string,

11
flow-typed/Lbry.js vendored
View file

@ -75,7 +75,16 @@ declare type BalanceResponse = {
declare type ResolveResponse = { declare type ResolveResponse = {
// Keys are the url(s) passed to resolve // Keys are the url(s) passed to resolve
[string]: { error?: {}, stream?: StreamClaim, channel?: ChannelClaim, collection?: CollectionClaim, claimsInChannel?: number }, [string]: {
error?: {
censor?: {},
text?: string,
},
stream?: StreamClaim,
channel?: ChannelClaim,
collection?: CollectionClaim,
claimsInChannel?: number
},
}; };
declare type GetResponse = FileListItem & { error?: string }; declare type GetResponse = FileListItem & { error?: string };

View file

@ -82,10 +82,6 @@ declare module 'lbryinc/src/redux/reducers/auth' {
declare module.exports: any; declare module.exports: any;
} }
declare module 'lbryinc/src/redux/reducers/blacklist' {
declare module.exports: any;
}
declare module 'lbryinc/src/redux/reducers/cost_info' { declare module 'lbryinc/src/redux/reducers/cost_info' {
declare module.exports: any; declare module.exports: any;
} }
@ -212,9 +208,6 @@ declare module 'lbryinc/src/redux/actions/user.js' {
declare module 'lbryinc/src/redux/reducers/auth.js' { declare module 'lbryinc/src/redux/reducers/auth.js' {
declare module.exports: $Exports<'lbryinc/src/redux/reducers/auth'>; declare module.exports: $Exports<'lbryinc/src/redux/reducers/auth'>;
} }
declare module 'lbryinc/src/redux/reducers/blacklist.js' {
declare module.exports: $Exports<'lbryinc/src/redux/reducers/blacklist'>;
}
declare module 'lbryinc/src/redux/reducers/cost_info.js' { declare module 'lbryinc/src/redux/reducers/cost_info.js' {
declare module.exports: $Exports<'lbryinc/src/redux/reducers/cost_info'>; declare module.exports: $Exports<'lbryinc/src/redux/reducers/cost_info'>;
} }

View file

@ -2319,5 +2319,8 @@
"Your hub has blocked this content because it subscribes to the following blocking channel:": "Your hub has blocked this content because it subscribes to the following blocking channel:", "Your hub has blocked this content because it subscribes to the following blocking channel:": "Your hub has blocked this content because it subscribes to the following blocking channel:",
"Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.": "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.", "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.": "Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.",
"Autoplay Next is on.": "Autoplay Next is on.", "Autoplay Next is on.": "Autoplay Next is on.",
"Content Blocked": "Content Blocked",
"Your hub has blocked %content% because it subscribes to the following blocking channel:": "Your hub has blocked %content% because it subscribes to the following blocking channel:",
"Your hub has blocked %content% because it subscribes to %channel%. You can change your hub in %settings%.": "Your hub has blocked %content% because it subscribes to %channel%. You can change your hub in %settings%.",
"--end--": "--end--" "--end--": "--end--"
} }

View file

@ -19,7 +19,6 @@ import {
import { doFetchItemsInCollection, doCollectionDelete } from 'redux/actions/collections'; import { doFetchItemsInCollection, doCollectionDelete } from 'redux/actions/collections';
import { doResolveUri } from 'redux/actions/claims'; import { doResolveUri } from 'redux/actions/claims';
import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import CollectionPreviewTile from './view'; import CollectionPreviewTile from './view';
@ -42,8 +41,6 @@ const select = (state, props) => {
isResolvingUri: collectionUri && selectIsUriResolving(state, collectionUri), isResolvingUri: collectionUri && selectIsUriResolving(state, collectionUri),
thumbnail: getThumbnailFromClaim(claim), thumbnail: getThumbnailFromClaim(claim),
title: collectionUri && selectTitleForUri(state, collectionUri), title: collectionUri && selectTitleForUri(state, collectionUri),
blackListedOutpoints: selectBlackListedOutpoints(state),
filteredOutpoints: selectFilteredOutpoints(state),
blockedChannelUris: selectMutedChannels(state), blockedChannelUris: selectMutedChannels(state),
showMature: selectShowMatureContent(state), showMature: selectShowMatureContent(state),
isMature: makeSelectClaimIsNsfw(collectionUri)(state), isMature: makeSelectClaimIsNsfw(collectionUri)(state),

View file

@ -25,14 +25,6 @@ type Props = {
thumbnail?: string, thumbnail?: string,
title?: string, title?: string,
placeholder: boolean, placeholder: boolean,
blackListedOutpoints: Array<{
txid: string,
nout: number,
}>,
filteredOutpoints: Array<{
txid: string,
nout: number,
}>,
blockedChannelUris: Array<string>, blockedChannelUris: Array<string>,
isMature?: boolean, isMature?: boolean,
showMature: boolean, showMature: boolean,

View file

@ -8,7 +8,6 @@ import {
makeSelectMetadataItemForUri, makeSelectMetadataItemForUri,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { doResolveUri } from 'redux/actions/claims'; import { doResolveUri } from 'redux/actions/claims';
import { selectBlackListedOutpoints } from 'lbryinc';
import PreviewLink from './view'; import PreviewLink from './view';
const select = (state, props) => { const select = (state, props) => {
@ -22,7 +21,6 @@ const select = (state, props) => {
description: makeSelectMetadataItemForUri(props.uri, 'description')(state), description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
channelIsMine: selectClaimIsMine(state, claim), channelIsMine: selectClaimIsMine(state, claim),
isResolvingUri: selectIsUriResolving(state, props.uri), isResolvingUri: selectIsUriResolving(state, props.uri),
blackListedOutpoints: selectBlackListedOutpoints(state),
}; };
}; };

View file

@ -9,7 +9,7 @@ import eventTracking from 'videojs-event-tracking';
import * as OVERLAY from './overlays'; import * as OVERLAY from './overlays';
import './plugins/videojs-mobile-ui/plugin'; import './plugins/videojs-mobile-ui/plugin';
import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin'; import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin';
import recsys from './plugins/videojs-recsys/plugin'; // import recsys from './plugins/videojs-recsys/plugin'; // points to view tracking plugin
import qualityLevels from 'videojs-contrib-quality-levels'; import qualityLevels from 'videojs-contrib-quality-levels';
import LbryVolumeBarClass from './lbry-volume-bar'; import LbryVolumeBarClass from './lbry-volume-bar';
import keyboardShorcuts from './videojs-keyboard-shortcuts'; import keyboardShorcuts from './videojs-keyboard-shortcuts';
@ -92,9 +92,9 @@ if (!Object.keys(videojs.getPlugins()).includes('qualityLevels')) {
videojs.registerPlugin('qualityLevels', qualityLevels); videojs.registerPlugin('qualityLevels', qualityLevels);
} }
if (!Object.keys(videojs.getPlugins()).includes('recsys')) { // if (!Object.keys(videojs.getPlugins()).includes('recsys')) {
videojs.registerPlugin('recsys', recsys); // videojs.registerPlugin('recsys', recsys);
} // }
// **************************************************************************** // ****************************************************************************
// VideoJs // VideoJs

View file

@ -470,18 +470,6 @@ export const REPORT_CONTENT_STARTED = 'REPORT_CONTENT_STARTED';
export const REPORT_CONTENT_COMPLETED = 'REPORT_CONTENT_COMPLETED'; export const REPORT_CONTENT_COMPLETED = 'REPORT_CONTENT_COMPLETED';
export const REPORT_CONTENT_FAILED = 'REPORT_CONTENT_FAILED'; export const REPORT_CONTENT_FAILED = 'REPORT_CONTENT_FAILED';
// Blacklist
export const FETCH_BLACK_LISTED_CONTENT_STARTED = 'FETCH_BLACK_LISTED_CONTENT_STARTED';
export const FETCH_BLACK_LISTED_CONTENT_COMPLETED = 'FETCH_BLACK_LISTED_CONTENT_COMPLETED';
export const FETCH_BLACK_LISTED_CONTENT_FAILED = 'FETCH_BLACK_LISTED_CONTENT_FAILED';
export const BLACK_LISTED_CONTENT_SUBSCRIBE = 'BLACK_LISTED_CONTENT_SUBSCRIBE';
// Filtered list
export const FETCH_FILTERED_CONTENT_STARTED = 'FETCH_FILTERED_CONTENT_STARTED';
export const FETCH_FILTERED_CONTENT_COMPLETED = 'FETCH_FILTERED_CONTENT_COMPLETED';
export const FETCH_FILTERED_CONTENT_FAILED = 'FETCH_FILTERED_CONTENT_FAILED';
export const FILTERED_CONTENT_SUBSCRIBE = 'FILTERED_CONTENT_SUBSCRIBE';
// Stats // Stats
export const FETCH_VIEW_COUNT_STARTED = 'FETCH_VIEW_COUNT_STARTED'; export const FETCH_VIEW_COUNT_STARTED = 'FETCH_VIEW_COUNT_STARTED';
export const FETCH_VIEW_COUNT_FAILED = 'FETCH_VIEW_COUNT_FAILED'; export const FETCH_VIEW_COUNT_FAILED = 'FETCH_VIEW_COUNT_FAILED';

View file

@ -29,7 +29,7 @@ import {
import { isURIValid } from 'util/lbryURI'; import { isURIValid } from 'util/lbryURI';
import { setSearchApi } from 'redux/actions/search'; import { setSearchApi } from 'redux/actions/search';
import { doSetLanguage, doFetchLanguage, doUpdateIsNightAsync } from 'redux/actions/settings'; import { doSetLanguage, doFetchLanguage, doUpdateIsNightAsync } from 'redux/actions/settings';
import { Lbryio, doBlackListedOutpointsSubscribe, doFilteredOutpointsSubscribe } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import rewards from 'rewards'; import rewards from 'rewards';
import { store, persistor, history } from 'store'; import { store, persistor, history } from 'store';
import app from './app'; import app from './app';
@ -274,8 +274,6 @@ function AppWrapper() {
} }
app.store.dispatch(doUpdateIsNightAsync()); app.store.dispatch(doUpdateIsNightAsync());
app.store.dispatch(doDaemonReady()); app.store.dispatch(doDaemonReady());
app.store.dispatch(doBlackListedOutpointsSubscribe());
app.store.dispatch(doFilteredOutpointsSubscribe());
const appReadyTime = Date.now(); const appReadyTime = Date.now();
const timeToStart = appReadyTime - startTime; const timeToStart = appReadyTime - startTime;

View file

@ -9,7 +9,7 @@ import {
makeSelectClaimIsPending, makeSelectClaimIsPending,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { selectMyUnpublishedCollections } from 'redux/selectors/collections'; import { selectMyUnpublishedCollections } from 'redux/selectors/collections';
import { selectBlackListedOutpoints, doFetchSubCount, selectSubCountForUri } from 'lbryinc'; // ban state import { doFetchSubCount, selectSubCountForUri } from 'lbryinc'; // ban state
import { selectYoutubeChannels } from 'redux/selectors/user'; import { selectYoutubeChannels } from 'redux/selectors/user';
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions'; import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
import { selectModerationBlockList } from 'redux/selectors/comments'; import { selectModerationBlockList } from 'redux/selectors/comments';
@ -28,7 +28,6 @@ const select = (state, props) => {
page: selectCurrentChannelPage(state), page: selectCurrentChannelPage(state),
claim, claim,
isSubscribed: selectIsSubscribedForUri(state, props.uri), isSubscribed: selectIsSubscribedForUri(state, props.uri),
blackListedOutpoints: selectBlackListedOutpoints(state),
subCount: selectSubCountForUri(state, props.uri), subCount: selectSubCountForUri(state, props.uri),
pending: makeSelectClaimIsPending(props.uri)(state), pending: makeSelectClaimIsPending(props.uri)(state),
youtubeChannels: selectYoutubeChannels(state), youtubeChannels: selectYoutubeChannels(state),

View file

@ -50,10 +50,6 @@ type Props = {
channelIsMine: boolean, channelIsMine: boolean,
isSubscribed: boolean, isSubscribed: boolean,
channelIsBlocked: boolean, channelIsBlocked: boolean,
blackListedOutpoints: Array<{
txid: string,
nout: number,
}>,
fetchSubCount: (string) => void, fetchSubCount: (string) => void,
subCount: number, subCount: number,
pending: boolean, pending: boolean,
@ -72,7 +68,6 @@ function ChannelPage(props: Props) {
// page, ?page= may come back some day? // page, ?page= may come back some day?
channelIsMine, channelIsMine,
isSubscribed, isSubscribed,
blackListedOutpoints,
fetchSubCount, fetchSubCount,
subCount, subCount,
pending, pending,
@ -135,14 +130,6 @@ function ChannelPage(props: Props) {
collectionEmpty = <section className="main--empty">{__('No Lists Found')}</section>; collectionEmpty = <section className="main--empty">{__('No Lists Found')}</section>;
} }
let channelIsBlackListed = false;
if (claim && blackListedOutpoints) {
channelIsBlackListed = blackListedOutpoints.some(
(outpoint) => outpoint.txid === claim.txid && outpoint.nout === claim.nout
);
}
// If a user changes tabs, update the url so it stays on the same page if they refresh. // If a user changes tabs, update the url so it stays on the same page if they refresh.
// We don't want to use links here because we can't animate the tab change and using links // We don't want to use links here because we can't animate the tab change and using links
// would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers. // would alter the Tab label's role attribute, which should stay role="tab" to work with keyboards/screen readers.
@ -219,9 +206,9 @@ function ChannelPage(props: Props) {
navigate={`/$/${PAGES.CHANNELS}`} navigate={`/$/${PAGES.CHANNELS}`}
/> />
)} )}
{!channelIsBlackListed && <ShareButton uri={uri} />} <ShareButton uri={uri} />
{!(isBlocked || isMuted) && <ClaimSupportButton uri={uri} />} {!(isBlocked || isMuted) && <ClaimSupportButton uri={uri} />}
{!(isBlocked || isMuted) && (!channelIsBlackListed || isSubscribed) && <SubscribeButton uri={permanentUrl} />} {!(isBlocked || isMuted) && isSubscribed && <SubscribeButton uri={permanentUrl} />}
{/* TODO: add channel collections <ClaimCollectionAddButton uri={uri} fileAction /> */} {/* TODO: add channel collections <ClaimCollectionAddButton uri={uri} fileAction /> */}
<ClaimMenuList uri={claim.permanent_url} inline isChannelPage /> <ClaimMenuList uri={claim.permanent_url} inline isChannelPage />
</div> </div>
@ -293,7 +280,6 @@ function ChannelPage(props: Props) {
{currentView === PAGE.CONTENT && ( {currentView === PAGE.CONTENT && (
<ChannelContent <ChannelContent
uri={uri} uri={uri}
channelIsBlackListed={channelIsBlackListed}
viewHiddenChannels viewHiddenChannels
claimType={['stream', 'repost']} claimType={['stream', 'repost']}
empty={<section className="main--empty">{__('No Content Found')}</section>} empty={<section className="main--empty">{__('No Content Found')}</section>}
@ -302,13 +288,7 @@ function ChannelPage(props: Props) {
</TabPanel> </TabPanel>
<TabPanel> <TabPanel>
{currentView === PAGE.LISTS && ( {currentView === PAGE.LISTS && (
<ChannelContent <ChannelContent claimType={'collection'} uri={uri} viewHiddenChannels empty={collectionEmpty} />
claimType={'collection'}
uri={uri}
channelIsBlackListed={channelIsBlackListed}
viewHiddenChannels
empty={collectionEmpty}
/>
)} )}
</TabPanel> </TabPanel>
<TabPanel> <TabPanel>

View file

@ -1,12 +1,12 @@
// @flow // @flow
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import I18nMessage from 'component/i18nMessage';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
import ChannelPage from 'page/channel'; import ChannelPage from 'page/channel';
import Page from 'component/page'; import Page from 'component/page';
import Button from 'component/button'; import Button from 'component/button';
import Card from 'component/common/card';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
import { parseURI } from 'util/lbryURI'; import { parseURI } from 'util/lbryURI';
import * as COLLECTIONS_CONSTS from 'constants/collections'; import * as COLLECTIONS_CONSTS from 'constants/collections';
@ -117,6 +117,7 @@ function ShowPage(props: Props) {
{!isResolvingUri && !isSubscribed && ( {!isResolvingUri && !isSubscribed && (
<div className="main--empty"> <div className="main--empty">
<Yrbl <Yrbl
type={'sad'}
title={isChannel ? __('Channel Not Found') : __('No Content Found')} title={isChannel ? __('Channel Not Found') : __('No Content Found')}
subtitle={ subtitle={
isChannel ? ( isChannel ? (
@ -147,33 +148,49 @@ function ShowPage(props: Props) {
} else if (isBlacklisted && !claimIsMine) { } else if (isBlacklisted && !claimIsMine) {
innerContent = isBlacklistedDueToDMCA ? ( innerContent = isBlacklistedDueToDMCA ? (
<Page> <Page>
<Card <div className="main--empty">
title={uri} <Yrbl
subtitle={__( title={isChannel ? __('Channel Not Found') : __('No Content Found')}
'Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.' subtitle={__(
)} 'Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.'
actions={ )}
<div className="section__actions"> actions={
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} /> <div className="section__actions">
</div> <Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
} </div>
/> }
/>
</div>
</Page> </Page>
) : ( ) : (
<Page> <Page>
<Card <div className="main--empty">
title={uri} <Yrbl
subtitle={ type={'sad'}
<> title={__('Content Blocked')}
{__('Your hub has blocked this content because it subscribes to the following blocking channel:')}{' '} subtitle={
<Button <div>
button="link" <I18nMessage
navigate={errorCensor && errorCensor.canonical_url} tokens={{
label={errorCensor && errorCensor.name} content: uri,
/> settings: <Button button="link" label={__('Settings')} navigate={`/$/${PAGES.SETTINGS}`} />,
</> channel: (
} <Button
/> button="link"
navigate={errorCensor && errorCensor.canonical_url}
label={errorCensor && errorCensor.name}
/>
),
}}
>
Your hub has blocked %content% because it subscribes to %channel%. You can change your hub in
%settings%.
</I18nMessage>
{/* {errorCensor && <p>{`Message:\n${errorCensor.text}`}</p>} */}
</div>
}
/>
</div>
</Page> </Page>
); );
} else if (claim) { } else if (claim) {

View file

@ -1,6 +1,6 @@
import { combineReducers } from 'redux'; import { combineReducers } from 'redux';
import { connectRouter } from 'connected-react-router'; import { connectRouter } from 'connected-react-router';
import { costInfoReducer, blacklistReducer, filteredReducer, statsReducer } from 'lbryinc'; import { costInfoReducer, statsReducer } from 'lbryinc';
import { claimsReducer } from 'redux/reducers/claims'; import { claimsReducer } from 'redux/reducers/claims';
import { fileInfoReducer } from 'redux/reducers/file_info'; import { fileInfoReducer } from 'redux/reducers/file_info';
import { walletReducer } from 'redux/reducers/wallet'; import { walletReducer } from 'redux/reducers/wallet';
@ -25,8 +25,6 @@ export default (history) =>
combineReducers({ combineReducers({
router: connectRouter(history), router: connectRouter(history),
app: appReducer, app: appReducer,
blacklist: blacklistReducer,
filtered: filteredReducer,
claims: claimsReducer, claims: claimsReducer,
comments: commentsReducer, comments: commentsReducer,
content: contentReducer, content: contentReducer,

View file

@ -86,8 +86,25 @@ export function doResolveUris(
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
if (uriResolveInfo) { if (uriResolveInfo) {
if (uriResolveInfo.error) { if (uriResolveInfo.error) {
// $FlowFixMe // TODO: handled filtered too
resolveInfo[uri] = { ...fallbackResolveInfo, errorCensor: uriResolveInfo.error.censor }; if (uriResolveInfo.error.name === 'BLOCKED') {
// $FlowFixMe
resolveInfo[uri] = {
// $FlowFixMe
...fallbackResolveInfo,
errorCensor: {
// $FlowFixMe
...uriResolveInfo.error.censor,
// $FlowFixMe
text: uriResolveInfo.error.text,
}, // $FlowFixMe
};
} else {
// $FlowFixMe
resolveInfo[uri] = {
...fallbackResolveInfo,
};
}
} else { } else {
if (checkReposts) { if (checkReposts) {
if (uriResolveInfo.reposted_claim) { if (uriResolveInfo.reposted_claim) {

View file

@ -4,7 +4,6 @@ import { selectSupportsByOutpoint } from 'redux/selectors/wallet';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { createCachedSelector } from 're-reselect'; import { createCachedSelector } from 're-reselect';
import { isClaimNsfw, filterClaims } from 'util/claim'; import { isClaimNsfw, filterClaims } from 'util/claim';
import { selectBlackListedOutpoints } from 'lbryinc';
import * as CLAIM from 'constants/claim'; import * as CLAIM from 'constants/claim';
type State = { claims: any }; type State = { claims: any };
@ -84,6 +83,7 @@ export const selectClaimIdForUri = (state: State, uri: string) => selectClaimIds
export const selectReflectingById = (state: State) => selectState(state).reflectingById; export const selectReflectingById = (state: State) => selectState(state).reflectingById;
// TODO: remove this.
export const makeSelectBlacklistedDueToDMCA = (claimUri: string) => export const makeSelectBlacklistedDueToDMCA = (claimUri: string) =>
createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => { createSelector(makeSelectClaimErrorCensor(claimUri), (claimError) => {
if (!claimError) { if (!claimError) {
@ -96,33 +96,20 @@ export const makeSelectClaimErrorCensor = (claimUri: string) =>
createSelector(selectState, (state) => state.blacklistedByUri[claimUri]); createSelector(selectState, (state) => state.blacklistedByUri[claimUri]);
export const makeSelectIsBlacklisted = (claimUri: string) => export const makeSelectIsBlacklisted = (claimUri: string) =>
createSelector( createSelector(makeSelectClaimErrorCensor(claimUri), makeSelectClaimForUri(claimUri), (errorCensor, claim) => {
makeSelectClaimErrorCensor(claimUri), if (errorCensor) {
selectBlackListedOutpoints, return true;
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;
} }
); // 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]); export const makeSelectClaimForClaimId = (claimId: string) => createSelector(selectClaimsById, (byId) => byId[claimId]);

View file

@ -4,7 +4,6 @@ import { createCachedSelector } from 're-reselect';
import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import { selectMentionSearchResults, selectMentionQuery } from 'redux/selectors/search'; import { selectMentionSearchResults, selectMentionQuery } from 'redux/selectors/search';
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
import { import {
selectClaimsById, selectClaimsById,
selectMyClaimIdsRaw, selectMyClaimIdsRaw,
@ -198,10 +197,8 @@ const filterCommentsDepOnList = {
claimsById: selectClaimsById, claimsById: selectClaimsById,
myClaimIds: selectMyClaimIdsRaw, myClaimIds: selectMyClaimIdsRaw,
myChannelClaimIds: selectMyChannelClaimIds, myChannelClaimIds: selectMyChannelClaimIds,
mutedChannels: selectMutedChannels,
personalBlockList: selectModerationBlockList, personalBlockList: selectModerationBlockList,
blacklistedMap: selectBlacklistedOutpointMap, mutedChannels: selectMutedChannels,
filteredMap: selectFilteredOutpointMap,
showMatureContent: selectShowMatureContent, showMatureContent: selectShowMatureContent,
}; };
@ -284,16 +281,8 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
return acc; return acc;
}, {}); }, {});
const { const { claimsById, myClaimIds, myChannelClaimIds, personalBlockList, mutedChannels, showMatureContent } =
claimsById, filterProps;
myClaimIds,
myChannelClaimIds,
mutedChannels,
personalBlockList,
blacklistedMap,
filteredMap,
showMatureContent,
} = filterProps;
return comments return comments
? comments.filter((comment) => { ? comments.filter((comment) => {
@ -317,11 +306,6 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
} }
} }
const outpoint = `${channelClaim.txid}:${channelClaim.nout}`;
if (blacklistedMap[outpoint] || filteredMap[outpoint]) {
return false;
}
if (!showMatureContent) { if (!showMatureContent) {
const claimIsMature = isClaimNsfw(channelClaim); const claimIsMature = isClaimNsfw(channelClaim);
if (claimIsMature) { if (claimIsMature) {