Restore blocked code.
This commit is contained in:
parent
63b19a92aa
commit
7288cc15ce
14 changed files with 71 additions and 16 deletions
|
@ -6,15 +6,17 @@
|
||||||
|
|
||||||
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 { 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,
|
||||||
|
selectMutedChannels,
|
||||||
selectModerationBlockList,
|
selectModerationBlockList,
|
||||||
(state, uri) => makeSelectIsBlacklisted(uri)(state),
|
(state, uri) => makeSelectIsBlacklisted(uri)(state),
|
||||||
(claim, personalBlocklist, isBlacklisted) => {
|
(claim, mutedChannelUris, personalBlocklist, isBlacklisted) => {
|
||||||
const banState = {};
|
const banState = {};
|
||||||
|
|
||||||
if (!claim) {
|
if (!claim) {
|
||||||
|
@ -27,6 +29,14 @@ export const selectBanStateForUri = createCachedSelector(
|
||||||
banState['blacklisted'] = true;
|
banState['blacklisted'] = 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))) {
|
||||||
|
|
|
@ -9,6 +9,7 @@ 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';
|
||||||
|
@ -26,7 +27,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: false,
|
channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state),
|
||||||
claim,
|
claim,
|
||||||
isAuthenticated: selectUserVerifiedEmail(state),
|
isAuthenticated: selectUserVerifiedEmail(state),
|
||||||
showMature: selectShowMatureContent(state),
|
showMature: selectShowMatureContent(state),
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
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 = () => ({
|
const select = (state, props) => ({
|
||||||
isMuted: false,
|
isMuted: makeSelectChannelIsMuted(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, {
|
export default connect(select, {
|
||||||
|
|
|
@ -8,6 +8,7 @@ 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';
|
||||||
|
@ -23,7 +24,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: [],
|
mutedUris: selectMutedChannels(state),
|
||||||
blockedUris: selectModerationBlockList(state),
|
blockedUris: selectModerationBlockList(state),
|
||||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@ 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 {
|
||||||
|
@ -62,7 +63,7 @@ const select = (state, props) => {
|
||||||
COLLECTIONS_CONSTS.FAVORITES_ID,
|
COLLECTIONS_CONSTS.FAVORITES_ID,
|
||||||
contentPermanentUri
|
contentPermanentUri
|
||||||
)(state),
|
)(state),
|
||||||
channelIsMuted: false,
|
channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state),
|
||||||
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
|
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state),
|
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state),
|
||||||
isSubscribed: selectIsSubscribedForUri(state, contentChannelUri),
|
isSubscribed: selectIsSubscribedForUri(state, contentChannelUri),
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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';
|
||||||
|
|
||||||
|
@ -15,7 +16,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 = [];
|
const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state);
|
||||||
|
|
||||||
const options = resolveSearchOptions({
|
const options = resolveSearchOptions({
|
||||||
showNsfw,
|
showNsfw,
|
||||||
|
|
|
@ -18,6 +18,7 @@ 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 { selectShowMatureContent } from 'redux/selectors/settings';
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||||
import CollectionPreviewTile from './view';
|
import CollectionPreviewTile from './view';
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ const select = (state, props) => {
|
||||||
title: collectionUri && selectTitleForUri(state, collectionUri),
|
title: collectionUri && selectTitleForUri(state, collectionUri),
|
||||||
blackListedOutpoints: [],
|
blackListedOutpoints: [],
|
||||||
filteredOutpoints: [],
|
filteredOutpoints: [],
|
||||||
blockedChannelUris: [],
|
blockedChannelUris: selectMutedChannels(state),
|
||||||
showMature: selectShowMatureContent(state),
|
showMature: selectShowMatureContent(state),
|
||||||
isMature: makeSelectClaimIsNsfw(collectionUri)(state),
|
isMature: makeSelectClaimIsNsfw(collectionUri)(state),
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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';
|
||||||
|
@ -31,7 +32,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: Boolean(author_uri),
|
channelIsBlocked: author_uri && makeSelectChannelIsMuted(author_uri)(state),
|
||||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||||
othersReacts: selectOthersReactsForComment(state, reactionKey),
|
othersReacts: selectOthersReactsForComment(state, reactionKey),
|
||||||
activeChannelClaim,
|
activeChannelClaim,
|
||||||
|
|
|
@ -13,6 +13,7 @@ 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';
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ const select = (state, props) => {
|
||||||
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: [],
|
mutedChannels: selectMutedChannels(state),
|
||||||
unpublishedCollections: selectMyUnpublishedCollections(state),
|
unpublishedCollections: selectMyUnpublishedCollections(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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';
|
||||||
|
@ -7,7 +8,7 @@ import ChannelsFollowingManagePage from './view';
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
followedTags: selectFollowedTags(state),
|
followedTags: selectFollowedTags(state),
|
||||||
subscribedChannels: selectSubscriptions(state),
|
subscribedChannels: selectSubscriptions(state),
|
||||||
blockedChannels: [],
|
blockedChannels: selectMutedChannels(state),
|
||||||
homepageData: selectHomepageData(state),
|
homepageData: selectHomepageData(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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,
|
||||||
|
@ -15,7 +16,7 @@ import { selectMyChannelClaimIds } from 'redux/selectors/claims';
|
||||||
import ListBlocked from './view';
|
import ListBlocked from './view';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
mutedUris: [],
|
mutedUris: selectMutedChannels(state),
|
||||||
personalBlockList: selectModerationBlockList(state),
|
personalBlockList: selectModerationBlockList(state),
|
||||||
adminBlockList: selectAdminBlockList(state),
|
adminBlockList: selectAdminBlockList(state),
|
||||||
moderatorBlockList: selectModeratorBlockList(state),
|
moderatorBlockList: selectModeratorBlockList(state),
|
||||||
|
|
26
ui/redux/selectors/blocked.js
Normal file
26
ui/redux/selectors/blocked.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// @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();
|
||||||
|
}
|
||||||
|
);
|
|
@ -1,6 +1,7 @@
|
||||||
// @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 {
|
import {
|
||||||
|
@ -197,6 +198,7 @@ const filterCommentsDepOnList = {
|
||||||
myClaimIds: selectMyClaimIdsRaw,
|
myClaimIds: selectMyClaimIdsRaw,
|
||||||
myChannelClaimIds: selectMyChannelClaimIds,
|
myChannelClaimIds: selectMyChannelClaimIds,
|
||||||
personalBlockList: selectModerationBlockList,
|
personalBlockList: selectModerationBlockList,
|
||||||
|
mutedChannels: selectMutedChannels,
|
||||||
showMatureContent: selectShowMatureContent,
|
showMatureContent: selectShowMatureContent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -279,7 +281,8 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const { claimsById, myClaimIds, myChannelClaimIds, personalBlockList, showMatureContent } = filterProps;
|
const { claimsById, myClaimIds, myChannelClaimIds, personalBlockList, mutedChannels, showMatureContent } =
|
||||||
|
filterProps;
|
||||||
|
|
||||||
return comments
|
return comments
|
||||||
? comments.filter((comment) => {
|
? comments.filter((comment) => {
|
||||||
|
@ -320,7 +323,7 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return !mutedChannels.includes(comment.channel_url);
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,7 @@ 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';
|
||||||
|
|
||||||
|
@ -57,10 +58,11 @@ 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, costInfoByUri, searchUrisByQuery, isMature) => {
|
(uri, history, claimsByUri, matureEnabled, blockedChannels, costInfoByUri, searchUrisByQuery, isMature) => {
|
||||||
const claim = claimsByUri[uri];
|
const claim = claimsByUri[uri];
|
||||||
|
|
||||||
if (!claim) return;
|
if (!claim) return;
|
||||||
|
@ -95,13 +97,17 @@ 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;
|
return !isEqualUri && !blockedMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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
|
||||||
|
|
Loading…
Reference in a new issue