~Final~ Discovery fixes/cleanup #2599

Merged
neb-b merged 16 commits from discovery-fixes into master 2019-07-05 20:03:12 +02:00
Showing only changes of commit 22281c76e4 - Show all commits

View file

@ -56,17 +56,14 @@ function ClaimPreview(props: Props) {
const abandoned = !isResolvingUri && !claim && !placeholder;
const { isChannel } = parseURI(uri);
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
kauffj commented 2019-07-03 18:21:56 +02:00 (Migrated from github.com)
Review

Below for loop can be functional. I admit that I may just enjoy rewriting these more than it is actually useful:

shouldHide = blackListedOutpoints.reduce((hide, outpoint) => 
  return hide || (outpoint.txid === claim.txid && outpoint.nout === claim.nout);
)
Below for loop can be functional. I admit that I may just enjoy rewriting these more than it is actually useful: ``` shouldHide = blackListedOutpoints.reduce((hide, outpoint) => return hide || (outpoint.txid === claim.txid && outpoint.nout === claim.nout); ) ```
neb-b commented 2019-07-05 20:12:59 +02:00 (Migrated from github.com)
Review

I was going to use this, but then I realized we should add a break statement to the for loop so we don't loop over the list when we don't need to. Now it will stop if it finds a matching item.

I was going to use this, but then I realized we should add a `break` statement to the for loop so we don't loop over the list when we don't need to. Now it will stop if it finds a matching item.
let shouldHide = abandoned || (!claimIsMine && obscureNsfw && nsfw);
// This will be replaced once blocking is done at the wallet server level
if (claim && !shouldHide && blackListedOutpoints) {
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
const outpoint = blackListedOutpoints[i];
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
shouldHide = true;
}
}
}
const shouldHide =
abandoned ||
(!claimIsMine && obscureNsfw && nsfw) ||
(claim &&
blackListedOutpoints &&
blackListedOutpoints.reduce((hide, outpoint) => {
return hide || (outpoint.txid === claim.txid && outpoint.nout === claim.nout);
}));
function handleContextMenu(e) {
e.preventDefault();