From 3e23aacaff4f898a2ec23f33a6ff4edd05c0c3a6 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 25 Feb 2021 13:07:54 -0500 Subject: [PATCH] hide blocked + muted content everywhere --- ui/component/claimListDiscover/index.js | 4 +++- ui/component/claimListDiscover/view.jsx | 9 ++++++--- ui/component/claimPreview/index.js | 4 +++- ui/component/claimPreview/view.jsx | 16 ++++++++-------- ui/redux/selectors/comments.js | 5 ++--- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/ui/component/claimListDiscover/index.js b/ui/component/claimListDiscover/index.js index 03fc8d69b..e31b36103 100644 --- a/ui/component/claimListDiscover/index.js +++ b/ui/component/claimListDiscover/index.js @@ -10,6 +10,7 @@ import { selectFollowedTags } from 'redux/selectors/tags'; import { selectMutedChannels } from 'redux/selectors/blocked'; import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings'; +import { selectModerationBlockList } from 'redux/selectors/comments'; import ClaimListDiscover from './view'; const select = (state) => ({ @@ -20,7 +21,8 @@ const select = (state) => ({ showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), languageSetting: selectLanguage(state), - hiddenUris: selectMutedChannels(state), + mutedUris: selectMutedChannels(state), + blockedUris: selectModerationBlockList(state), searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state), }); diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index efb971573..f6c19ef20 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -30,7 +30,8 @@ type Props = { [string]: Array, }, claimSearchByQueryLastPageReached: { [string]: boolean }, - hiddenUris: Array, + mutedUris: Array, + blockedUris: Array, hiddenNsfwMessage?: Node, channelIds?: Array, claimIds?: Array, @@ -79,7 +80,8 @@ function ClaimListDiscover(props: Props) { hideReposts, history, location, - hiddenUris, + mutedUris, + blockedUris, hiddenNsfwMessage, defaultOrderBy, orderBy, @@ -125,6 +127,7 @@ function ClaimListDiscover(props: Props) { (urlParams.get(CS.TAGS_KEY) !== null && urlParams.get(CS.TAGS_KEY)) || (defaultTags && getParamFromTags(defaultTags)); const freshnessParam = freshness || urlParams.get(CS.FRESH_KEY) || defaultFreshness; + const mutedAndBlockedChannelIds = mutedUris.concat(blockedUris).map((uri) => uri.split('#')[1]); const langParam = urlParams.get(CS.LANGUAGE_KEY) || null; const languageParams = searchInLanguage @@ -204,7 +207,7 @@ function ClaimListDiscover(props: Props) { no_totals: true, not_channel_ids: // If channelIdsParam were passed in, we don't need not_channel_ids - !channelIdsParam && hiddenUris && hiddenUris.length ? hiddenUris.map((hiddenUri) => hiddenUri.split('#')[1]) : [], + !channelIdsParam ? mutedAndBlockedChannelIds : [], not_tags: !showNsfw ? MATURE_TAGS : [], order_by: orderParam === CS.ORDER_BY_TRENDING diff --git a/ui/component/claimPreview/index.js b/ui/component/claimPreview/index.js index 5fd393479..753ca69cf 100644 --- a/ui/component/claimPreview/index.js +++ b/ui/component/claimPreview/index.js @@ -16,6 +16,7 @@ import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { selectShowMatureContent } from 'redux/selectors/settings'; import { makeSelectHasVisitedUri } from 'redux/selectors/content'; import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions'; +import { selectModerationBlockList } from 'redux/selectors/comments'; import ClaimPreview from './view'; const select = (state, props) => ({ @@ -30,7 +31,8 @@ const select = (state, props) => ({ nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state), blackListedOutpoints: selectBlackListedOutpoints(state), filteredOutpoints: selectFilteredOutpoints(state), - blockedChannelUris: selectMutedChannels(state), + mutedUris: selectMutedChannels(state), + blockedUris: selectModerationBlockList(state), hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state), channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state), isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state), diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index db8b6639d..03dd5ca31 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -53,7 +53,8 @@ type Props = { txid: string, nout: number, }>, - blockedChannelUris: Array, + mutedUris: Array, + blockedUris: Array, channelIsBlocked: boolean, actions: boolean | Node | string | number, properties: boolean | Node | string | number | ((Claim) => Node), @@ -112,7 +113,8 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { properties, onClick, actions, - blockedChannelUris, + mutedUris, + blockedUris, blackListedOutpoints, filteredOutpoints, includeSupportAction, @@ -170,13 +172,11 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { ); } // block stream claims - if (claim && !shouldHide && !showUserBlocked && blockedChannelUris.length && signingChannel) { - shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === signingChannel.permanent_url); + if (claim && !shouldHide && !showUserBlocked && mutedUris.length && signingChannel) { + shouldHide = mutedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url); } - // block channel claims if we can't control for them in claim search - // e.g. fetchRecommendedSubscriptions - if (claim && isChannelUri && !shouldHide && !showUserBlocked && blockedChannelUris.length) { - shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url); + if (claim && !shouldHide && !showUserBlocked && blockedUris.length && signingChannel) { + shouldHide = blockedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url); } if (!shouldHide && customShouldHide && claim) { diff --git a/ui/redux/selectors/comments.js b/ui/redux/selectors/comments.js index 3310d4908..caaea1344 100644 --- a/ui/redux/selectors/comments.js +++ b/ui/redux/selectors/comments.js @@ -13,9 +13,8 @@ export const selectIsFetchingComments = createSelector(selectState, (state) => s export const selectIsPostingComment = createSelector(selectState, (state) => state.isCommenting); export const selectIsFetchingReacts = createSelector(selectState, (state) => state.isFetchingReacts); export const selectOthersReactsById = createSelector(selectState, (state) => state.othersReactsByCommentId); -export const selectModerationBlockList = createSelector( - selectState, - (state) => state.moderationBlockList && state.moderationBlockList.reverse() +export const selectModerationBlockList = createSelector(selectState, (state) => + state.moderationBlockList ? state.moderationBlockList.reverse() : [] ); export const selectBlockingByUri = createSelector(selectState, (state) => state.blockingByUri); export const selectUnBlockingByUri = createSelector(selectState, (state) => state.unBlockingByUri);