fix search result uri building and empty array reduce warning

This commit is contained in:
Jeremy Kauffman 2017-04-20 19:26:29 -04:00
parent a8d85d7c1d
commit f2d6bc3dcf
3 changed files with 7 additions and 3 deletions

View file

@ -517,7 +517,7 @@ lbry._updateClaimOwnershipCache = function(claimId) {
lbry.getMyClaims((claimInfos) => { lbry.getMyClaims((claimInfos) => {
lbry._claimIdOwnershipCache[claimId] = !!claimInfos.reduce(function(match, claimInfo) { lbry._claimIdOwnershipCache[claimId] = !!claimInfos.reduce(function(match, claimInfo) {
return match || claimInfo.claim_id == claimId; return match || claimInfo.claim_id == claimId;
}); }, false);
}); });
}; };

View file

@ -140,9 +140,12 @@ lbryuri.build = function(uriObj, includeProto=true, allowExtraProps=false) {
} }
if (contentName) { if (contentName) {
if (!path) { if (!name) {
name = contentName;
} else if (!path) {
path = contentName; 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.'); throw new Error('path and contentName do not match. Only one is required; most likely you wanted contentName.');
} }
} }

View file

@ -46,6 +46,7 @@ var SearchResults = React.createClass({
render: function() { render: function() {
var rows = [], var rows = [],
seenNames = {}; //fix this when the search API returns claim IDs 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) { for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of this.props.results) {
const uri = lbryuri.build({ const uri = lbryuri.build({
channelName: channel_name, channelName: channel_name,