hide blocked + muted content everywhere
This commit is contained in:
parent
33a0b063c4
commit
3e23aacaff
5 changed files with 22 additions and 16 deletions
|
@ -10,6 +10,7 @@ import { selectFollowedTags } from 'redux/selectors/tags';
|
||||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||||
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||||
|
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||||
import ClaimListDiscover from './view';
|
import ClaimListDiscover from './view';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
|
@ -20,7 +21,8 @@ const select = (state) => ({
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
|
||||||
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
|
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
|
||||||
languageSetting: selectLanguage(state),
|
languageSetting: selectLanguage(state),
|
||||||
hiddenUris: selectMutedChannels(state),
|
mutedUris: selectMutedChannels(state),
|
||||||
|
blockedUris: selectModerationBlockList(state),
|
||||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ type Props = {
|
||||||
[string]: Array<string>,
|
[string]: Array<string>,
|
||||||
},
|
},
|
||||||
claimSearchByQueryLastPageReached: { [string]: boolean },
|
claimSearchByQueryLastPageReached: { [string]: boolean },
|
||||||
hiddenUris: Array<string>,
|
mutedUris: Array<string>,
|
||||||
|
blockedUris: Array<string>,
|
||||||
hiddenNsfwMessage?: Node,
|
hiddenNsfwMessage?: Node,
|
||||||
channelIds?: Array<string>,
|
channelIds?: Array<string>,
|
||||||
claimIds?: Array<string>,
|
claimIds?: Array<string>,
|
||||||
|
@ -79,7 +80,8 @@ function ClaimListDiscover(props: Props) {
|
||||||
hideReposts,
|
hideReposts,
|
||||||
history,
|
history,
|
||||||
location,
|
location,
|
||||||
hiddenUris,
|
mutedUris,
|
||||||
|
blockedUris,
|
||||||
hiddenNsfwMessage,
|
hiddenNsfwMessage,
|
||||||
defaultOrderBy,
|
defaultOrderBy,
|
||||||
orderBy,
|
orderBy,
|
||||||
|
@ -125,6 +127,7 @@ function ClaimListDiscover(props: Props) {
|
||||||
(urlParams.get(CS.TAGS_KEY) !== null && urlParams.get(CS.TAGS_KEY)) ||
|
(urlParams.get(CS.TAGS_KEY) !== null && urlParams.get(CS.TAGS_KEY)) ||
|
||||||
(defaultTags && getParamFromTags(defaultTags));
|
(defaultTags && getParamFromTags(defaultTags));
|
||||||
const freshnessParam = freshness || urlParams.get(CS.FRESH_KEY) || defaultFreshness;
|
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 langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
||||||
const languageParams = searchInLanguage
|
const languageParams = searchInLanguage
|
||||||
|
@ -204,7 +207,7 @@ function ClaimListDiscover(props: Props) {
|
||||||
no_totals: true,
|
no_totals: true,
|
||||||
not_channel_ids:
|
not_channel_ids:
|
||||||
// If channelIdsParam were passed in, we don't need 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 : [],
|
not_tags: !showNsfw ? MATURE_TAGS : [],
|
||||||
order_by:
|
order_by:
|
||||||
orderParam === CS.ORDER_BY_TRENDING
|
orderParam === CS.ORDER_BY_TRENDING
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||||
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||||
|
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||||
import ClaimPreview from './view';
|
import ClaimPreview from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -30,7 +31,8 @@ const select = (state, props) => ({
|
||||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
filteredOutpoints: selectFilteredOutpoints(state),
|
filteredOutpoints: selectFilteredOutpoints(state),
|
||||||
blockedChannelUris: selectMutedChannels(state),
|
mutedUris: selectMutedChannels(state),
|
||||||
|
blockedUris: selectModerationBlockList(state),
|
||||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||||
|
|
|
@ -53,7 +53,8 @@ type Props = {
|
||||||
txid: string,
|
txid: string,
|
||||||
nout: number,
|
nout: number,
|
||||||
}>,
|
}>,
|
||||||
blockedChannelUris: Array<string>,
|
mutedUris: Array<string>,
|
||||||
|
blockedUris: Array<string>,
|
||||||
channelIsBlocked: boolean,
|
channelIsBlocked: boolean,
|
||||||
actions: boolean | Node | string | number,
|
actions: boolean | Node | string | number,
|
||||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||||
|
@ -112,7 +113,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
properties,
|
properties,
|
||||||
onClick,
|
onClick,
|
||||||
actions,
|
actions,
|
||||||
blockedChannelUris,
|
mutedUris,
|
||||||
|
blockedUris,
|
||||||
blackListedOutpoints,
|
blackListedOutpoints,
|
||||||
filteredOutpoints,
|
filteredOutpoints,
|
||||||
includeSupportAction,
|
includeSupportAction,
|
||||||
|
@ -170,13 +172,11 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// block stream claims
|
// block stream claims
|
||||||
if (claim && !shouldHide && !showUserBlocked && blockedChannelUris.length && signingChannel) {
|
if (claim && !shouldHide && !showUserBlocked && mutedUris.length && signingChannel) {
|
||||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
shouldHide = mutedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||||
}
|
}
|
||||||
// block channel claims if we can't control for them in claim search
|
if (claim && !shouldHide && !showUserBlocked && blockedUris.length && signingChannel) {
|
||||||
// e.g. fetchRecommendedSubscriptions
|
shouldHide = blockedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||||
if (claim && isChannelUri && !shouldHide && !showUserBlocked && blockedChannelUris.length) {
|
|
||||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldHide && customShouldHide && claim) {
|
if (!shouldHide && customShouldHide && claim) {
|
||||||
|
|
|
@ -13,9 +13,8 @@ export const selectIsFetchingComments = createSelector(selectState, (state) => s
|
||||||
export const selectIsPostingComment = createSelector(selectState, (state) => state.isCommenting);
|
export const selectIsPostingComment = createSelector(selectState, (state) => state.isCommenting);
|
||||||
export const selectIsFetchingReacts = createSelector(selectState, (state) => state.isFetchingReacts);
|
export const selectIsFetchingReacts = createSelector(selectState, (state) => state.isFetchingReacts);
|
||||||
export const selectOthersReactsById = createSelector(selectState, (state) => state.othersReactsByCommentId);
|
export const selectOthersReactsById = createSelector(selectState, (state) => state.othersReactsByCommentId);
|
||||||
export const selectModerationBlockList = createSelector(
|
export const selectModerationBlockList = createSelector(selectState, (state) =>
|
||||||
selectState,
|
state.moderationBlockList ? state.moderationBlockList.reverse() : []
|
||||||
(state) => state.moderationBlockList && state.moderationBlockList.reverse()
|
|
||||||
);
|
);
|
||||||
export const selectBlockingByUri = createSelector(selectState, (state) => state.blockingByUri);
|
export const selectBlockingByUri = createSelector(selectState, (state) => state.blockingByUri);
|
||||||
export const selectUnBlockingByUri = createSelector(selectState, (state) => state.unBlockingByUri);
|
export const selectUnBlockingByUri = createSelector(selectState, (state) => state.unBlockingByUri);
|
||||||
|
|
Loading…
Reference in a new issue