When user hits "Watch", don't check balance if download already started

This commit is contained in:
Alex Liebowitz 2017-02-23 03:45:43 -05:00
parent a24c6ed281
commit fb421cdd79
2 changed files with 25 additions and 14 deletions

View file

@ -18,7 +18,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
*
### Fixed
*
* When user hits "Watch," don't check balance if download already started
*
*

View file

@ -10,11 +10,19 @@ import {DropDownMenu, DropDownMenuItem} from './menu.js';
let WatchLink = React.createClass({
propTypes: {
streamName: React.PropTypes.string,
downloadStarted: React.PropTypes.bool,
},
startVideo: function() {
window.location = '?watch=' + this.props.streamName;
},
handleClick: function() {
this.setState({
loading: true,
})
});
if (this.props.downloadStarted) {
this.startVideo();
} else {
lbry.getCostInfoForName(this.props.streamName, ({cost}) => {
lbry.getBalance((balance) => {
if (cost > balance) {
@ -23,10 +31,11 @@ let WatchLink = React.createClass({
loading: false,
});
} else {
window.location = '?watch=' + this.props.streamName;
this.startVideo();
}
});
});
}
},
getInitialState: function() {
return {
@ -190,7 +199,9 @@ let FileActionsRow = React.createClass({
return (
<div>
{(this.props.metadata.content_type && this.props.metadata.content_type.startsWith('video/')) ? <WatchLink streamName={this.props.streamName} /> : null}
{this.props.metadata.content_type && this.props.metadata.content_type.startsWith('video/')
? <WatchLink streamName={this.props.streamName} downloadStarted={!!this.state.fileInfo} />
: null}
{this.state.fileInfo !== null || this.state.fileInfo.isMine
? linkBlock
: null}