take previous bid into account for total available to deposit #1725

Merged
neb-b merged 2 commits from 1712 into master 2018-07-02 22:11:02 +02:00
2 changed files with 11 additions and 3 deletions

View file

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Fixed
* Take previous bid amount into account when determining how much users have available to deposit ([#1725](https://github.com/lbryio/lbry-app/pull/1725))
### Changed

View file

@ -152,14 +152,21 @@ class PublishForm extends React.PureComponent<Props> {
}
handleBidChange(bid: number) {
const { balance, updatePublishForm } = this.props;
const { balance, updatePublishForm, myClaimForUri } = this.props;
let previousBidAmount = 0;
if (myClaimForUri) {
previousBidAmount = myClaimForUri.amount;
}
const totalAvailableBidAmount = previousBidAmount + balance;
kauffj commented 2018-07-02 21:20:02 +02:00 (Migrated from github.com)
Review

This logic would conceivably be better placed in a selector, but otherwise LGTM

This logic would conceivably be better placed in a selector, but otherwise LGTM
let bidError;
if (bid === 0) {
bidError = __('Deposit cannot be 0');
} else if (balance === bid) {
} else if (totalAvailableBidAmount === bid) {
bidError = __('Please decrease your deposit to account for transaction fees');
} else if (balance < bid) {
} else if (totalAvailableBidAmount < bid) {
bidError = __('Deposit cannot be higher than your balance');
} else if (bid <= MINIMUM_PUBLISH_BID) {
bidError = __('Your deposit must be higher');