From f2d6bc3dcff09b67d7a192d0cda8f1d2069afdba Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 20 Apr 2017 19:26:29 -0400 Subject: [PATCH] fix search result uri building and empty array reduce warning --- ui/js/lbry.js | 2 +- ui/js/lbryuri.js | 7 +++++-- ui/js/page/discover.js | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/js/lbry.js b/ui/js/lbry.js index adc8ba4b4..e265f43d7 100644 --- a/ui/js/lbry.js +++ b/ui/js/lbry.js @@ -517,7 +517,7 @@ lbry._updateClaimOwnershipCache = function(claimId) { lbry.getMyClaims((claimInfos) => { lbry._claimIdOwnershipCache[claimId] = !!claimInfos.reduce(function(match, claimInfo) { return match || claimInfo.claim_id == claimId; - }); + }, false); }); }; diff --git a/ui/js/lbryuri.js b/ui/js/lbryuri.js index 55a964e66..2712b812a 100644 --- a/ui/js/lbryuri.js +++ b/ui/js/lbryuri.js @@ -140,9 +140,12 @@ lbryuri.build = function(uriObj, includeProto=true, allowExtraProps=false) { } if (contentName) { - if (!path) { + if (!name) { + name = contentName; + } else if (!path) { path = contentName; - } else if (path !== contentName) { + } + if (path && path !== contentName) { throw new Error('path and contentName do not match. Only one is required; most likely you wanted contentName.'); } } diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js index dc2811cfd..b6afa426f 100644 --- a/ui/js/page/discover.js +++ b/ui/js/page/discover.js @@ -46,6 +46,7 @@ var SearchResults = React.createClass({ render: function() { var rows = [], seenNames = {}; //fix this when the search API returns claim IDs + for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of this.props.results) { const uri = lbryuri.build({ channelName: channel_name,