Geoblock: fix anonymous claims passing through

My bad, added an unnecessary check in the previous change that shorted the logic too early.

Accessing an object using 'null' or 'undefined' as the key won't cause trouble (and is expected in this case), so just suppress flow instead of fixing it using
  `channelId && geoBlockLists.livestreams[channelId]`

https://github.com/OdyseeTeam/odysee-frontend/issues/1100#issuecomment-1138928520
This commit is contained in:
infinite-persistence 2022-05-27 12:49:12 +08:00
parent f0bf6fa9a0
commit 7504cf07b3
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -15,19 +15,16 @@ export function getGeoRestrictionForClaim(claim: ?StreamClaim, locale: LocaleInf
const claimId: ?string = claim.claim_id;
const channelId: ?string = getChannelIdFromClaim(claim);
if (!claimId || !channelId) {
console.log('Claim with blank data:', claim); // eslint-disable-line no-console
return null;
}
let geoConfig: ?GeoConfig;
// --- livestreams
if (isStreamPlaceholderClaim(claim) && geoBlockLists.livestreams) {
// $FlowIgnore: null key is fine
geoConfig = geoBlockLists.livestreams[channelId] || geoBlockLists.livestreams[claimId];
}
// --- videos (actually, everything else)
else if (geoBlockLists.videos) {
// $FlowIgnore: null key is fine
geoConfig = geoBlockLists.videos[channelId] || geoBlockLists.videos[claimId];
}