From c8220e0c0800058e50fd7fcb2195bb8e826c6b38 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Fri, 2 Sep 2016 02:49:50 -0400 Subject: [PATCH] On Show page, don't display wrong name when given a nonexistent name Now shows 404-like "no content here" message instead --- js/page/show.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/js/page/show.js b/js/page/show.js index f1d9e2f56..89469c59d 100644 --- a/js/page/show.js +++ b/js/page/show.js @@ -107,6 +107,7 @@ var DetailPage = React.createClass({ claimInfo: null, amount: null, searching: true, + matchFound: null, }; }, componentWillMount: function() { @@ -114,12 +115,21 @@ var DetailPage = React.createClass({ lbry.search(this.props.name, (results) => { var result = results[0]; - this.setState({ - amount: result.cost, - available: result.available, - claimInfo: result.value, - searching: false, - }); + + if (result.name != this.props.name) { + this.setState({ + searching: false, + matchFound: false, + }); + } else { + this.setState({ + amount: result.cost, + available: result.available, + claimInfo: result.value, + searching: false, + matchFound: true, + }); + } }); }, render: function() { @@ -136,7 +146,14 @@ var DetailPage = React.createClass({ return (
- + {this.state.matchFound ? ( + + ) : ( +
+

No content

+ There is no content available at the name lbry://{this.props.name}. If you reached this page from a link within the LBRY interface, please . Thanks! +
+ )}
); }