Remove blocked and filtered reducers/selectors/actions.

This commit is contained in:
Franco Montenegro 2022-08-30 17:22:30 -03:00 committed by zeppi
parent 7dbeeac112
commit d33856434e
25 changed files with 22 additions and 350 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';
@ -47,13 +43,10 @@ export {
selectBlackListedOutpoints, selectBlackListedOutpoints,
selectBlacklistedOutpointMap, selectBlacklistedOutpointMap,
} from './redux/selectors/blacklist'; } 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

@ -6,20 +6,15 @@
import { createCachedSelector } from 're-reselect'; 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 { 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,
selectModerationBlockList, selectModerationBlockList,
(state, uri) => makeSelectIsBlacklisted(uri)(state), (state, uri) => makeSelectIsBlacklisted(uri)(state),
(claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist, isBlacklisted) => { (claim, personalBlocklist, isBlacklisted) => {
const banState = {}; const banState = {};
if (!claim) { if (!claim) {
@ -32,35 +27,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 channel claims if we can't control for them in claim search
if (mutedChannelUris.length && channelClaim) {
if (mutedChannelUris.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {
banState['muted'] = true;
}
}
// Commentron blocklist // Commentron blocklist
if (personalBlocklist.length && channelClaim) { if (personalBlocklist.length && channelClaim) {
if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) { if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) {

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

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

@ -9,7 +9,6 @@ import {
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { doResolveUris } from 'redux/actions/claims'; import { doResolveUris } from 'redux/actions/claims';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings'; import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
@ -27,7 +26,7 @@ const select = (state, props) => {
fetching: makeSelectFetchingChannelClaims(props.uri)(state), fetching: makeSelectFetchingChannelClaims(props.uri)(state),
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state), totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
channelIsMine: selectClaimIsMine(state, claim), channelIsMine: selectClaimIsMine(state, claim),
channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state), channelIsBlocked: false,
claim, claim,
isAuthenticated: selectUserVerifiedEmail(state), isAuthenticated: selectUserVerifiedEmail(state),
showMature: selectShowMatureContent(state), showMature: selectShowMatureContent(state),

View file

@ -1,10 +1,9 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked'; import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import ChannelMuteButton from './view'; import ChannelMuteButton from './view';
const select = (state, props) => ({ const select = () => ({
isMuted: makeSelectChannelIsMuted(props.uri)(state), isMuted: false,
}); });
export default connect(select, { export default connect(select, {

View file

@ -8,7 +8,6 @@ import {
import { doClaimSearch } from 'redux/actions/claims'; import { doClaimSearch } from 'redux/actions/claims';
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings'; import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
import { selectModerationBlockList } from 'redux/selectors/comments'; import { selectModerationBlockList } from 'redux/selectors/comments';
@ -24,7 +23,7 @@ const select = (state) => ({
showNsfw: selectShowMatureContent(state), showNsfw: selectShowMatureContent(state),
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
languageSetting: selectLanguage(state), languageSetting: selectLanguage(state),
mutedUris: selectMutedChannels(state), mutedUris: [],
blockedUris: selectModerationBlockList(state), blockedUris: selectModerationBlockList(state),
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
}); });

View file

@ -12,7 +12,6 @@ import {
} from 'redux/selectors/collections'; } from 'redux/selectors/collections';
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info'; import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import * as COLLECTIONS_CONSTS from 'constants/collections'; import * as COLLECTIONS_CONSTS from 'constants/collections';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked'; import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app'; import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app';
import { import {
@ -63,7 +62,7 @@ const select = (state, props) => {
COLLECTIONS_CONSTS.FAVORITES_ID, COLLECTIONS_CONSTS.FAVORITES_ID,
contentPermanentUri contentPermanentUri
)(state), )(state),
channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state), channelIsMuted: false,
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state), channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state), fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state),
isSubscribed: selectIsSubscribedForUri(state, contentChannelUri), isSubscribed: selectIsSubscribedForUri(state, contentChannelUri),

View file

@ -7,7 +7,6 @@ import { MATURE_TAGS } from 'constants/tags';
import { doFetchViewCount } from 'lbryinc'; import { doFetchViewCount } from 'lbryinc';
import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings'; import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
import { selectMutedAndBlockedChannelIds } from 'redux/selectors/blocked';
import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
import { createNormalizedClaimSearchKey } from 'util/claim'; import { createNormalizedClaimSearchKey } from 'util/claim';
@ -16,7 +15,7 @@ import ClaimListDiscover from './view';
const select = (state, props) => { const select = (state, props) => {
const showNsfw = selectShowMatureContent(state); const showNsfw = selectShowMatureContent(state);
const hideReposts = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state); const hideReposts = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state);
const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state); const mutedAndBlockedChannelIds = [];
const options = resolveSearchOptions({ const options = resolveSearchOptions({
showNsfw, showNsfw,

View file

@ -18,8 +18,6 @@ import {
} from 'redux/selectors/collections'; } from 'redux/selectors/collections';
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 { 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,9 +40,9 @@ 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), blackListedOutpoints: [],
filteredOutpoints: selectFilteredOutpoints(state), filteredOutpoints: [],
blockedChannelUris: selectMutedChannels(state), blockedChannelUris: [],
showMature: selectShowMatureContent(state), showMature: selectShowMatureContent(state),
isMature: makeSelectClaimIsNsfw(collectionUri)(state), isMature: makeSelectClaimIsNsfw(collectionUri)(state),
}; };

View file

@ -7,7 +7,6 @@ import {
selectMyClaimIdsRaw, selectMyClaimIdsRaw,
} from 'redux/selectors/claims'; } from 'redux/selectors/claims';
import { doCommentUpdate, doCommentList } from 'redux/actions/comments'; import { doCommentUpdate, doCommentList } from 'redux/actions/comments';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications'; import { doToast } from 'redux/actions/notifications';
import { doClearPlayingUri } from 'redux/actions/content'; import { doClearPlayingUri } from 'redux/actions/content';
import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { selectUserVerifiedEmail } from 'redux/selectors/user';
@ -32,7 +31,7 @@ const select = (state, props) => {
myChannelIds: selectMyClaimIdsRaw(state), myChannelIds: selectMyClaimIdsRaw(state),
claim: makeSelectClaimForUri(uri)(state), claim: makeSelectClaimForUri(uri)(state),
thumbnail: author_uri && selectThumbnailForUri(state, author_uri), thumbnail: author_uri && selectThumbnailForUri(state, author_uri),
channelIsBlocked: author_uri && makeSelectChannelIsMuted(author_uri)(state), channelIsBlocked: Boolean(author_uri),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true, commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
othersReacts: selectOthersReactsForComment(state, reactionKey), othersReacts: selectOthersReactsForComment(state, reactionKey),
activeChannelClaim, activeChannelClaim,

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,11 +9,10 @@ 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';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import ChannelPage from './view'; import ChannelPage from './view';
@ -28,12 +27,12 @@ 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), blackListedOutpoints: [],
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),
blockedChannels: selectModerationBlockList(state), // banlist blockedChannels: selectModerationBlockList(state), // banlist
mutedChannels: selectMutedChannels(state), mutedChannels: [],
unpublishedCollections: selectMyUnpublishedCollections(state), unpublishedCollections: selectMyUnpublishedCollections(state),
}; };
}; };

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectFollowedTags } from 'redux/selectors/tags'; import { selectFollowedTags } from 'redux/selectors/tags';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectSubscriptions } from 'redux/selectors/subscriptions';
import { selectHomepageData } from 'redux/selectors/settings'; import { selectHomepageData } from 'redux/selectors/settings';
import ChannelsFollowingManagePage from './view'; import ChannelsFollowingManagePage from './view';
@ -8,7 +7,7 @@ import ChannelsFollowingManagePage from './view';
const select = (state) => ({ const select = (state) => ({
followedTags: selectFollowedTags(state), followedTags: selectFollowedTags(state),
subscribedChannels: selectSubscriptions(state), subscribedChannels: selectSubscriptions(state),
blockedChannels: selectMutedChannels(state), blockedChannels: [],
homepageData: selectHomepageData(state), homepageData: selectHomepageData(state),
}); });

View file

@ -1,6 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments'; import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { import {
selectModerationBlockList, selectModerationBlockList,
selectAdminBlockList, selectAdminBlockList,
@ -16,7 +15,7 @@ import { selectMyChannelClaimIds } from 'redux/selectors/claims';
import ListBlocked from './view'; import ListBlocked from './view';
const select = (state) => ({ const select = (state) => ({
mutedUris: selectMutedChannels(state), mutedUris: [],
personalBlockList: selectModerationBlockList(state), personalBlockList: selectModerationBlockList(state),
adminBlockList: selectAdminBlockList(state), adminBlockList: selectAdminBlockList(state),
moderatorBlockList: selectModeratorBlockList(state), moderatorBlockList: selectModeratorBlockList(state),

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

@ -1,26 +0,0 @@
// @flow
import { createSelector } from 'reselect';
import { splitBySeparator } from 'util/lbryURI';
const selectState = (state: { blocked: BlocklistState }) => state.blocked || {};
export const selectMutedChannels = createSelector(selectState, (state: BlocklistState) => {
return state.blockedChannels.filter((e) => typeof e === 'string');
});
export const makeSelectChannelIsMuted = (uri: string) =>
createSelector(selectMutedChannels, (state: Array<string>) => {
return state.includes(uri);
});
export const selectMutedAndBlockedChannelIds = createSelector(
selectState,
(state) => state.comments,
(state, commentsState) => {
const mutedUris = state.blockedChannels;
const blockedUris = commentsState.moderationBlockList;
return Array.from(
new Set((mutedUris || []).concat(blockedUris || []).map((uri) => splitBySeparator(uri)[1]))
).sort();
}
);

View file

@ -1,10 +1,8 @@
// @flow // @flow
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { createCachedSelector } from 're-reselect'; import { createCachedSelector } from 're-reselect';
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 +196,7 @@ const filterCommentsDepOnList = {
claimsById: selectClaimsById, claimsById: selectClaimsById,
myClaimIds: selectMyClaimIdsRaw, myClaimIds: selectMyClaimIdsRaw,
myChannelClaimIds: selectMyChannelClaimIds, myChannelClaimIds: selectMyChannelClaimIds,
mutedChannels: selectMutedChannels,
personalBlockList: selectModerationBlockList, personalBlockList: selectModerationBlockList,
blacklistedMap: selectBlacklistedOutpointMap,
filteredMap: selectFilteredOutpointMap,
showMatureContent: selectShowMatureContent, showMatureContent: selectShowMatureContent,
}; };
@ -284,16 +279,7 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
return acc; return acc;
}, {}); }, {});
const { const { claimsById, myClaimIds, myChannelClaimIds, personalBlockList, showMatureContent } = filterProps;
claimsById,
myClaimIds,
myChannelClaimIds,
mutedChannels,
personalBlockList,
blacklistedMap,
filteredMap,
showMatureContent,
} = filterProps;
return comments return comments
? comments.filter((comment) => { ? comments.filter((comment) => {
@ -317,11 +303,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) {
@ -339,7 +320,7 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
} }
} }
return !mutedChannels.includes(comment.channel_url); return true;
}) })
: []; : [];
}; };

View file

@ -15,7 +15,6 @@ import { isClaimNsfw } from 'util/claim';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { createCachedSelector } from 're-reselect'; import { createCachedSelector } from 're-reselect';
import { createNormalizedSearchKey, getRecommendationSearchOptions } from 'util/search'; import { createNormalizedSearchKey, getRecommendationSearchOptions } from 'util/search';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectHistory } from 'redux/selectors/content'; import { selectHistory } from 'redux/selectors/content';
import { selectAllCostInfoByUri } from 'lbryinc'; import { selectAllCostInfoByUri } from 'lbryinc';
@ -58,11 +57,10 @@ export const selectRecommendedContentForUri = createCachedSelector(
selectHistory, selectHistory,
selectClaimsByUri, selectClaimsByUri,
selectShowMatureContent, selectShowMatureContent,
selectMutedChannels,
selectAllCostInfoByUri, selectAllCostInfoByUri,
selectSearchResultByQuery, selectSearchResultByQuery,
selectClaimIsNsfwForUri, // (state, uri) selectClaimIsNsfwForUri, // (state, uri)
(uri, history, claimsByUri, matureEnabled, blockedChannels, costInfoByUri, searchUrisByQuery, isMature) => { (uri, history, claimsByUri, matureEnabled, costInfoByUri, searchUrisByQuery, isMature) => {
const claim = claimsByUri[uri]; const claim = claimsByUri[uri];
if (!claim) return; if (!claim) return;
@ -97,17 +95,13 @@ export const selectRecommendedContentForUri = createCachedSelector(
if (!searchClaim) return; if (!searchClaim) return;
const signingChannel = searchClaim && searchClaim.signing_channel;
const channelUri = signingChannel && signingChannel.canonical_url;
const blockedMatch = blockedChannels.some((blockedUri) => blockedUri.includes(channelUri));
let isEqualUri; let isEqualUri;
try { try {
const { claimId: searchId } = parseURI(searchUri); const { claimId: searchId } = parseURI(searchUri);
isEqualUri = searchId === currentClaimId; isEqualUri = searchId === currentClaimId;
} catch (e) {} } catch (e) {}
return !isEqualUri && !blockedMatch; return !isEqualUri;
}); });
// Claim to play next: playable and free claims not played before in history // Claim to play next: playable and free claims not played before in history