Comment: filter geo-restricted channels
This commit is contained in:
parent
426d1ea0c9
commit
13729a2ed4
1 changed files with 14 additions and 1 deletions
|
@ -1,9 +1,10 @@
|
||||||
// @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 { selectGeoBlockLists, 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 { selectUserLocale } from 'redux/selectors/user';
|
||||||
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc';
|
||||||
import {
|
import {
|
||||||
selectClaimsById,
|
selectClaimsById,
|
||||||
|
@ -15,6 +16,7 @@ import {
|
||||||
import { isClaimNsfw, getChannelFromClaim } from 'util/claim';
|
import { isClaimNsfw, getChannelFromClaim } from 'util/claim';
|
||||||
import { selectSubscriptionUris } from 'redux/selectors/subscriptions';
|
import { selectSubscriptionUris } from 'redux/selectors/subscriptions';
|
||||||
import { getCommentsListTitle } from 'util/comments';
|
import { getCommentsListTitle } from 'util/comments';
|
||||||
|
import { getGeoRestrictionForClaim } from 'util/geoRestriction';
|
||||||
|
|
||||||
type State = { claims: any, comments: CommentsState, user: UserState };
|
type State = { claims: any, comments: CommentsState, user: UserState };
|
||||||
|
|
||||||
|
@ -208,6 +210,8 @@ const filterCommentsDepOnList = {
|
||||||
blacklistedMap: selectBlacklistedOutpointMap,
|
blacklistedMap: selectBlacklistedOutpointMap,
|
||||||
filteredMap: selectFilteredOutpointMap,
|
filteredMap: selectFilteredOutpointMap,
|
||||||
showMatureContent: selectShowMatureContent,
|
showMatureContent: selectShowMatureContent,
|
||||||
|
geoBlockList: selectGeoBlockLists,
|
||||||
|
locale: selectUserLocale,
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterCommentsPropKeys = Object.keys(filterCommentsDepOnList);
|
const filterCommentsPropKeys = Object.keys(filterCommentsDepOnList);
|
||||||
|
@ -292,6 +296,8 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||||
blacklistedMap,
|
blacklistedMap,
|
||||||
filteredMap,
|
filteredMap,
|
||||||
showMatureContent,
|
showMatureContent,
|
||||||
|
geoBlockList,
|
||||||
|
locale,
|
||||||
} = filterProps;
|
} = filterProps;
|
||||||
|
|
||||||
return comments
|
return comments
|
||||||
|
@ -338,6 +344,13 @@ const filterComments = (comments: Array<Comment>, claimId?: string, filterInputs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channelClaim) {
|
||||||
|
const geoRestriction: ?GeoRestriction = getGeoRestrictionForClaim(channelClaim, locale, geoBlockList);
|
||||||
|
if (geoRestriction) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return !mutedChannels.includes(comment.channel_url);
|
return !mutedChannels.includes(comment.channel_url);
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
|
|
Loading…
Reference in a new issue