From d33856434e08c07ea0ad86a71a5de2ced3b5714a Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Tue, 30 Aug 2022 17:22:30 -0300 Subject: [PATCH] Remove blocked and filtered reducers/selectors/actions. --- extras/lbryinc/constants/action_types.js | 12 ----- extras/lbryinc/index.js | 7 --- extras/lbryinc/redux/actions/blacklist.js | 52 --------------------- extras/lbryinc/redux/actions/filtered.js | 47 ------------------- extras/lbryinc/redux/reducers/blacklist.js | 37 --------------- extras/lbryinc/redux/reducers/filtered.js | 34 -------------- extras/lbryinc/redux/selectors/ban.js | 36 +------------- extras/lbryinc/redux/selectors/filtered.js | 20 -------- flow-typed/npm/lbryinc_vx.x.x.js | 7 --- ui/component/channelContent/index.js | 3 +- ui/component/channelMuteButton/index.js | 5 +- ui/component/claimListDiscover/index.js | 3 +- ui/component/claimMenuList/index.js | 3 +- ui/component/claimTilesDiscover/index.js | 3 +- ui/component/collectionPreviewTile/index.js | 8 ++-- ui/component/comment/index.js | 3 +- ui/constants/action_types.js | 12 ----- ui/index.jsx | 4 +- ui/page/channel/index.js | 7 ++- ui/page/channelsFollowingDiscover/index.js | 3 +- ui/page/listBlocked/index.js | 3 +- ui/reducers.js | 4 +- ui/redux/selectors/blocked.js | 26 ----------- ui/redux/selectors/comments.js | 23 +-------- ui/redux/selectors/search.js | 10 +--- 25 files changed, 22 insertions(+), 350 deletions(-) delete mode 100644 extras/lbryinc/redux/actions/blacklist.js delete mode 100644 extras/lbryinc/redux/actions/filtered.js delete mode 100644 extras/lbryinc/redux/reducers/blacklist.js delete mode 100644 extras/lbryinc/redux/reducers/filtered.js delete mode 100644 extras/lbryinc/redux/selectors/filtered.js delete mode 100644 ui/redux/selectors/blocked.js diff --git a/extras/lbryinc/constants/action_types.js b/extras/lbryinc/constants/action_types.js index 65723007d..a7e994b5e 100644 --- a/extras/lbryinc/constants/action_types.js +++ b/extras/lbryinc/constants/action_types.js @@ -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 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 export const FETCH_COST_INFO_STARTED = 'FETCH_COST_INFO_STARTED'; export const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED'; diff --git a/extras/lbryinc/index.js b/extras/lbryinc/index.js index df1b0f823..4adeef98d 100644 --- a/extras/lbryinc/index.js +++ b/extras/lbryinc/index.js @@ -14,8 +14,6 @@ export { doTransifexUpload } from 'util/transifex-upload'; // actions export { doGenerateAuthToken } from './redux/actions/auth'; 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 { doCheckSync, @@ -30,8 +28,6 @@ export { // reducers export { authReducer } from './redux/reducers/auth'; 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 { syncReducer } from './redux/reducers/sync'; @@ -47,13 +43,10 @@ export { selectBlackListedOutpoints, selectBlacklistedOutpointMap, } from './redux/selectors/blacklist'; -export { selectFilteredOutpoints, selectFilteredOutpointMap } from './redux/selectors/filtered'; export { selectViewCount, selectViewCountForUri, - // makeSelectViewCountForUri, // deprecated selectSubCountForUri, - // makeSelectSubCountForUri, // deprecated } from './redux/selectors/stats'; export { selectBanStateForUri } from './redux/selectors/ban'; export { diff --git a/extras/lbryinc/redux/actions/blacklist.js b/extras/lbryinc/redux/actions/blacklist.js deleted file mode 100644 index 4e0008691..000000000 --- a/extras/lbryinc/redux/actions/blacklist.js +++ /dev/null @@ -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); - }; -} diff --git a/extras/lbryinc/redux/actions/filtered.js b/extras/lbryinc/redux/actions/filtered.js deleted file mode 100644 index 4777c591d..000000000 --- a/extras/lbryinc/redux/actions/filtered.js +++ /dev/null @@ -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); - }; -} diff --git a/extras/lbryinc/redux/reducers/blacklist.js b/extras/lbryinc/redux/reducers/blacklist.js deleted file mode 100644 index 48d74b1ff..000000000 --- a/extras/lbryinc/redux/reducers/blacklist.js +++ /dev/null @@ -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 -); diff --git a/extras/lbryinc/redux/reducers/filtered.js b/extras/lbryinc/redux/reducers/filtered.js deleted file mode 100644 index 02147156d..000000000 --- a/extras/lbryinc/redux/reducers/filtered.js +++ /dev/null @@ -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 -); diff --git a/extras/lbryinc/redux/selectors/ban.js b/extras/lbryinc/redux/selectors/ban.js index 88cec158b..d6a686c07 100644 --- a/extras/lbryinc/redux/selectors/ban.js +++ b/extras/lbryinc/redux/selectors/ban.js @@ -6,20 +6,15 @@ import { createCachedSelector } from 're-reselect'; import { selectClaimForUri, makeSelectIsBlacklisted } from 'redux/selectors/claims'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectModerationBlockList } from 'redux/selectors/comments'; -import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc'; import { getChannelFromClaim } from 'util/claim'; import { isURIEqual } from 'util/lbryURI'; export const selectBanStateForUri = createCachedSelector( selectClaimForUri, - selectBlacklistedOutpointMap, - selectFilteredOutpointMap, - selectMutedChannels, selectModerationBlockList, (state, uri) => makeSelectIsBlacklisted(uri)(state), - (claim, blackListedOutpointMap, filteredOutpointMap, mutedChannelUris, personalBlocklist, isBlacklisted) => { + (claim, personalBlocklist, isBlacklisted) => { const banState = {}; if (!claim) { @@ -32,35 +27,6 @@ export const selectBanStateForUri = createCachedSelector( 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 if (personalBlocklist.length && channelClaim) { if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, channelClaim.permanent_url))) { diff --git a/extras/lbryinc/redux/selectors/filtered.js b/extras/lbryinc/redux/selectors/filtered.js deleted file mode 100644 index 46ea2b1fc..000000000 --- a/extras/lbryinc/redux/selectors/filtered.js +++ /dev/null @@ -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; - }, {}) - : {} -); diff --git a/flow-typed/npm/lbryinc_vx.x.x.js b/flow-typed/npm/lbryinc_vx.x.x.js index e796c99c3..30ba9faf9 100644 --- a/flow-typed/npm/lbryinc_vx.x.x.js +++ b/flow-typed/npm/lbryinc_vx.x.x.js @@ -82,10 +82,6 @@ declare module 'lbryinc/src/redux/reducers/auth' { 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.exports: any; } @@ -212,9 +208,6 @@ declare module 'lbryinc/src/redux/actions/user.js' { declare module 'lbryinc/src/redux/reducers/auth.js' { 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.exports: $Exports<'lbryinc/src/redux/reducers/cost_info'>; } diff --git a/ui/component/channelContent/index.js b/ui/component/channelContent/index.js index 46e9b29eb..e74dfd6aa 100644 --- a/ui/component/channelContent/index.js +++ b/ui/component/channelContent/index.js @@ -9,7 +9,6 @@ import { } from 'redux/selectors/claims'; import { doResolveUris } from 'redux/actions/claims'; import * as SETTINGS from 'constants/settings'; -import { makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import { withRouter } from 'react-router'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings'; @@ -27,7 +26,7 @@ const select = (state, props) => { fetching: makeSelectFetchingChannelClaims(props.uri)(state), totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state), channelIsMine: selectClaimIsMine(state, claim), - channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state), + channelIsBlocked: false, claim, isAuthenticated: selectUserVerifiedEmail(state), showMature: selectShowMatureContent(state), diff --git a/ui/component/channelMuteButton/index.js b/ui/component/channelMuteButton/index.js index 781ae1880..da02392dc 100644 --- a/ui/component/channelMuteButton/index.js +++ b/ui/component/channelMuteButton/index.js @@ -1,10 +1,9 @@ import { connect } from 'react-redux'; import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked'; -import { makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import ChannelMuteButton from './view'; -const select = (state, props) => ({ - isMuted: makeSelectChannelIsMuted(props.uri)(state), +const select = () => ({ + isMuted: false, }); export default connect(select, { diff --git a/ui/component/claimListDiscover/index.js b/ui/component/claimListDiscover/index.js index eac963d15..a33d94b65 100644 --- a/ui/component/claimListDiscover/index.js +++ b/ui/component/claimListDiscover/index.js @@ -8,7 +8,6 @@ import { import { doClaimSearch } from 'redux/actions/claims'; import * as SETTINGS from 'constants/settings'; import { selectFollowedTags } from 'redux/selectors/tags'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings'; import { selectModerationBlockList } from 'redux/selectors/comments'; @@ -24,7 +23,7 @@ const select = (state) => ({ showNsfw: selectShowMatureContent(state), hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), languageSetting: selectLanguage(state), - mutedUris: selectMutedChannels(state), + mutedUris: [], blockedUris: selectModerationBlockList(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), }); diff --git a/ui/component/claimMenuList/index.js b/ui/component/claimMenuList/index.js index 8439ffae6..cd121274b 100644 --- a/ui/component/claimMenuList/index.js +++ b/ui/component/claimMenuList/index.js @@ -12,7 +12,6 @@ import { } from 'redux/selectors/collections'; import { makeSelectFileInfoForUri } from 'redux/selectors/file_info'; import * as COLLECTIONS_CONSTS from 'constants/collections'; -import { makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked'; import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app'; import { @@ -63,7 +62,7 @@ const select = (state, props) => { COLLECTIONS_CONSTS.FAVORITES_ID, contentPermanentUri )(state), - channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state), + channelIsMuted: false, channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state), fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state), isSubscribed: selectIsSubscribedForUri(state, contentChannelUri), diff --git a/ui/component/claimTilesDiscover/index.js b/ui/component/claimTilesDiscover/index.js index 5aed218be..d5977fff5 100644 --- a/ui/component/claimTilesDiscover/index.js +++ b/ui/component/claimTilesDiscover/index.js @@ -7,7 +7,6 @@ import { MATURE_TAGS } from 'constants/tags'; import { doFetchViewCount } from 'lbryinc'; import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings'; -import { selectMutedAndBlockedChannelIds } from 'redux/selectors/blocked'; import { ENABLE_NO_SOURCE_CLAIMS } from 'config'; import { createNormalizedClaimSearchKey } from 'util/claim'; @@ -16,7 +15,7 @@ import ClaimListDiscover from './view'; const select = (state, props) => { const showNsfw = selectShowMatureContent(state); const hideReposts = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state); - const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state); + const mutedAndBlockedChannelIds = []; const options = resolveSearchOptions({ showNsfw, diff --git a/ui/component/collectionPreviewTile/index.js b/ui/component/collectionPreviewTile/index.js index 82cdd90b8..c83f2d27d 100644 --- a/ui/component/collectionPreviewTile/index.js +++ b/ui/component/collectionPreviewTile/index.js @@ -18,8 +18,6 @@ import { } from 'redux/selectors/collections'; import { doFetchItemsInCollection, doCollectionDelete } from 'redux/actions/collections'; import { doResolveUri } from 'redux/actions/claims'; -import { selectMutedChannels } from 'redux/selectors/blocked'; -import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { selectShowMatureContent } from 'redux/selectors/settings'; import CollectionPreviewTile from './view'; @@ -42,9 +40,9 @@ const select = (state, props) => { isResolvingUri: collectionUri && selectIsUriResolving(state, collectionUri), thumbnail: getThumbnailFromClaim(claim), title: collectionUri && selectTitleForUri(state, collectionUri), - blackListedOutpoints: selectBlackListedOutpoints(state), - filteredOutpoints: selectFilteredOutpoints(state), - blockedChannelUris: selectMutedChannels(state), + blackListedOutpoints: [], + filteredOutpoints: [], + blockedChannelUris: [], showMature: selectShowMatureContent(state), isMature: makeSelectClaimIsNsfw(collectionUri)(state), }; diff --git a/ui/component/comment/index.js b/ui/component/comment/index.js index 4b04bac5a..eab8eeeb3 100644 --- a/ui/component/comment/index.js +++ b/ui/component/comment/index.js @@ -7,7 +7,6 @@ import { selectMyClaimIdsRaw, } from 'redux/selectors/claims'; import { doCommentUpdate, doCommentList } from 'redux/actions/comments'; -import { makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import { doToast } from 'redux/actions/notifications'; import { doClearPlayingUri } from 'redux/actions/content'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; @@ -32,7 +31,7 @@ const select = (state, props) => { myChannelIds: selectMyClaimIdsRaw(state), claim: makeSelectClaimForUri(uri)(state), 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, othersReacts: selectOthersReactsForComment(state, reactionKey), activeChannelClaim, diff --git a/ui/constants/action_types.js b/ui/constants/action_types.js index 00cf938e4..e05fe428f 100644 --- a/ui/constants/action_types.js +++ b/ui/constants/action_types.js @@ -470,18 +470,6 @@ export const REPORT_CONTENT_STARTED = 'REPORT_CONTENT_STARTED'; export const REPORT_CONTENT_COMPLETED = 'REPORT_CONTENT_COMPLETED'; 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 export const FETCH_VIEW_COUNT_STARTED = 'FETCH_VIEW_COUNT_STARTED'; export const FETCH_VIEW_COUNT_FAILED = 'FETCH_VIEW_COUNT_FAILED'; diff --git a/ui/index.jsx b/ui/index.jsx index 995618625..101e9bba8 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -29,7 +29,7 @@ import { import { isURIValid } from 'util/lbryURI'; import { setSearchApi } from 'redux/actions/search'; import { doSetLanguage, doFetchLanguage, doUpdateIsNightAsync } from 'redux/actions/settings'; -import { Lbryio, doBlackListedOutpointsSubscribe, doFilteredOutpointsSubscribe } from 'lbryinc'; +import { Lbryio } from 'lbryinc'; import rewards from 'rewards'; import { store, persistor, history } from 'store'; import app from './app'; @@ -274,8 +274,6 @@ function AppWrapper() { } app.store.dispatch(doUpdateIsNightAsync()); app.store.dispatch(doDaemonReady()); - app.store.dispatch(doBlackListedOutpointsSubscribe()); - app.store.dispatch(doFilteredOutpointsSubscribe()); const appReadyTime = Date.now(); const timeToStart = appReadyTime - startTime; diff --git a/ui/page/channel/index.js b/ui/page/channel/index.js index 5e537a3d2..88ee18b16 100644 --- a/ui/page/channel/index.js +++ b/ui/page/channel/index.js @@ -9,11 +9,10 @@ import { makeSelectClaimIsPending, } from 'redux/selectors/claims'; 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 { selectIsSubscribedForUri } from 'redux/selectors/subscriptions'; import { selectModerationBlockList } from 'redux/selectors/comments'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { doOpenModal } from 'redux/actions/app'; import ChannelPage from './view'; @@ -28,12 +27,12 @@ const select = (state, props) => { page: selectCurrentChannelPage(state), claim, isSubscribed: selectIsSubscribedForUri(state, props.uri), - blackListedOutpoints: selectBlackListedOutpoints(state), + blackListedOutpoints: [], subCount: selectSubCountForUri(state, props.uri), pending: makeSelectClaimIsPending(props.uri)(state), youtubeChannels: selectYoutubeChannels(state), blockedChannels: selectModerationBlockList(state), // banlist - mutedChannels: selectMutedChannels(state), + mutedChannels: [], unpublishedCollections: selectMyUnpublishedCollections(state), }; }; diff --git a/ui/page/channelsFollowingDiscover/index.js b/ui/page/channelsFollowingDiscover/index.js index 72ae9b316..4eb18bc42 100644 --- a/ui/page/channelsFollowingDiscover/index.js +++ b/ui/page/channelsFollowingDiscover/index.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { selectFollowedTags } from 'redux/selectors/tags'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectSubscriptions } from 'redux/selectors/subscriptions'; import { selectHomepageData } from 'redux/selectors/settings'; import ChannelsFollowingManagePage from './view'; @@ -8,7 +7,7 @@ import ChannelsFollowingManagePage from './view'; const select = (state) => ({ followedTags: selectFollowedTags(state), subscribedChannels: selectSubscriptions(state), - blockedChannels: selectMutedChannels(state), + blockedChannels: [], homepageData: selectHomepageData(state), }); diff --git a/ui/page/listBlocked/index.js b/ui/page/listBlocked/index.js index 41f0e9f11..131d71d10 100644 --- a/ui/page/listBlocked/index.js +++ b/ui/page/listBlocked/index.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectModerationBlockList, selectAdminBlockList, @@ -16,7 +15,7 @@ import { selectMyChannelClaimIds } from 'redux/selectors/claims'; import ListBlocked from './view'; const select = (state) => ({ - mutedUris: selectMutedChannels(state), + mutedUris: [], personalBlockList: selectModerationBlockList(state), adminBlockList: selectAdminBlockList(state), moderatorBlockList: selectModeratorBlockList(state), diff --git a/ui/reducers.js b/ui/reducers.js index e29b357a2..c8ab5ad75 100644 --- a/ui/reducers.js +++ b/ui/reducers.js @@ -1,6 +1,6 @@ import { combineReducers } from 'redux'; 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 { fileInfoReducer } from 'redux/reducers/file_info'; import { walletReducer } from 'redux/reducers/wallet'; @@ -25,8 +25,6 @@ export default (history) => combineReducers({ router: connectRouter(history), app: appReducer, - blacklist: blacklistReducer, - filtered: filteredReducer, claims: claimsReducer, comments: commentsReducer, content: contentReducer, diff --git a/ui/redux/selectors/blocked.js b/ui/redux/selectors/blocked.js deleted file mode 100644 index 9977c6d8f..000000000 --- a/ui/redux/selectors/blocked.js +++ /dev/null @@ -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) => { - 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(); - } -); diff --git a/ui/redux/selectors/comments.js b/ui/redux/selectors/comments.js index 116c74360..1ad77e946 100644 --- a/ui/redux/selectors/comments.js +++ b/ui/redux/selectors/comments.js @@ -1,10 +1,8 @@ // @flow import { createSelector } from 'reselect'; import { createCachedSelector } from 're-reselect'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectMentionSearchResults, selectMentionQuery } from 'redux/selectors/search'; -import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc'; import { selectClaimsById, selectMyClaimIdsRaw, @@ -198,10 +196,7 @@ const filterCommentsDepOnList = { claimsById: selectClaimsById, myClaimIds: selectMyClaimIdsRaw, myChannelClaimIds: selectMyChannelClaimIds, - mutedChannels: selectMutedChannels, personalBlockList: selectModerationBlockList, - blacklistedMap: selectBlacklistedOutpointMap, - filteredMap: selectFilteredOutpointMap, showMatureContent: selectShowMatureContent, }; @@ -284,16 +279,7 @@ const filterComments = (comments: Array, claimId?: string, filterInputs return acc; }, {}); - const { - claimsById, - myClaimIds, - myChannelClaimIds, - mutedChannels, - personalBlockList, - blacklistedMap, - filteredMap, - showMatureContent, - } = filterProps; + const { claimsById, myClaimIds, myChannelClaimIds, personalBlockList, showMatureContent } = filterProps; return comments ? comments.filter((comment) => { @@ -317,11 +303,6 @@ const filterComments = (comments: Array, claimId?: string, filterInputs } } - const outpoint = `${channelClaim.txid}:${channelClaim.nout}`; - if (blacklistedMap[outpoint] || filteredMap[outpoint]) { - return false; - } - if (!showMatureContent) { const claimIsMature = isClaimNsfw(channelClaim); if (claimIsMature) { @@ -339,7 +320,7 @@ const filterComments = (comments: Array, claimId?: string, filterInputs } } - return !mutedChannels.includes(comment.channel_url); + return true; }) : []; }; diff --git a/ui/redux/selectors/search.js b/ui/redux/selectors/search.js index dea8e5254..e7d4bb055 100644 --- a/ui/redux/selectors/search.js +++ b/ui/redux/selectors/search.js @@ -15,7 +15,6 @@ import { isClaimNsfw } from 'util/claim'; import { createSelector } from 'reselect'; import { createCachedSelector } from 're-reselect'; import { createNormalizedSearchKey, getRecommendationSearchOptions } from 'util/search'; -import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectHistory } from 'redux/selectors/content'; import { selectAllCostInfoByUri } from 'lbryinc'; @@ -58,11 +57,10 @@ export const selectRecommendedContentForUri = createCachedSelector( selectHistory, selectClaimsByUri, selectShowMatureContent, - selectMutedChannels, selectAllCostInfoByUri, selectSearchResultByQuery, selectClaimIsNsfwForUri, // (state, uri) - (uri, history, claimsByUri, matureEnabled, blockedChannels, costInfoByUri, searchUrisByQuery, isMature) => { + (uri, history, claimsByUri, matureEnabled, costInfoByUri, searchUrisByQuery, isMature) => { const claim = claimsByUri[uri]; if (!claim) return; @@ -97,17 +95,13 @@ export const selectRecommendedContentForUri = createCachedSelector( 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; try { const { claimId: searchId } = parseURI(searchUri); isEqualUri = searchId === currentClaimId; } catch (e) {} - return !isEqualUri && !blockedMatch; + return !isEqualUri; }); // Claim to play next: playable and free claims not played before in history