Fix geoblocked items appearing in wunderbar suggestion popup

This list is not using ClaimPreview or ClaimPreviewTile, so the filtering was missed.
This commit is contained in:
infinite-persistence 2022-05-25 14:37:09 +08:00
parent 4aa94a7bfd
commit a4add6eab6
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 14 additions and 2 deletions

View file

@ -1,5 +1,10 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { selectClaimForUri, selectIsUriResolving, selectOdyseeMembershipForUri } from 'redux/selectors/claims'; import {
selectClaimForUri,
selectGeoRestrictionForUri,
selectIsUriResolving,
selectOdyseeMembershipForUri,
} from 'redux/selectors/claims';
import WunderbarSuggestion from './view'; import WunderbarSuggestion from './view';
const select = (state, props) => { const select = (state, props) => {
@ -8,6 +13,7 @@ const select = (state, props) => {
return { return {
claim: selectClaimForUri(state, uri), claim: selectClaimForUri(state, uri),
isResolvingUri: selectIsUriResolving(state, uri), isResolvingUri: selectIsUriResolving(state, uri),
geoRestriction: selectGeoRestrictionForUri(state, props.uri),
odyseeMembership: selectOdyseeMembershipForUri(state, uri), odyseeMembership: selectOdyseeMembershipForUri(state, uri),
}; };
}; };

View file

@ -12,11 +12,12 @@ type Props = {
claim: ?Claim, claim: ?Claim,
uri: string, uri: string,
isResolvingUri: boolean, isResolvingUri: boolean,
geoRestriction: ?GeoRestriction,
odyseeMembership: ?string, odyseeMembership: ?string,
}; };
export default function WunderbarSuggestion(props: Props) { export default function WunderbarSuggestion(props: Props) {
const { claim, uri, isResolvingUri, odyseeMembership } = props; const { claim, uri, isResolvingUri, odyseeMembership, geoRestriction } = props;
if (isResolvingUri) { if (isResolvingUri) {
return ( return (
@ -32,6 +33,11 @@ export default function WunderbarSuggestion(props: Props) {
return null; return null;
} }
if (geoRestriction) {
// Could display something else in the future, but hide completely for now.
return null;
}
const isChannel = claim.value_type === 'channel'; const isChannel = claim.value_type === 'channel';
const isCollection = claim.value_type === 'collection'; const isCollection = claim.value_type === 'collection';