From 9bcb75e2343529439ede42861236df91382e461c Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 15 Mar 2018 02:44:44 -0400 Subject: [PATCH 1/3] Add checks for 0 and exact balance Otherwise, you get an ugly "internal error" --- .../component/publishForm/internal/channelSection.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/renderer/component/publishForm/internal/channelSection.jsx b/src/renderer/component/publishForm/internal/channelSection.jsx index b36c1b317..32e390bdb 100644 --- a/src/renderer/component/publishForm/internal/channelSection.jsx +++ b/src/renderer/component/publishForm/internal/channelSection.jsx @@ -57,6 +57,16 @@ class ChannelSection extends React.PureComponent { return; } + if (newChannelBid == 0) { + this.refs.newChannelName.showError(__('Bid value must be greater than 0.')); + + return; + } + if (newChannelBid == balance) { + this.refs.newChannelName.showError(__('Please decrease your bid to account for transaction fees.')); + + return; + } this.setState({ creatingChannel: true, From 34e971cd7f7d6f172069bacb565377c0d3a95af6 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 15 Mar 2018 02:46:50 -0400 Subject: [PATCH 2/3] remove check for balance during publish This is being correctly done on the daemon now and the app shows appropriate error --- src/renderer/component/publishForm/view.jsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/renderer/component/publishForm/view.jsx b/src/renderer/component/publishForm/view.jsx index 4f770a803..b07f6083f 100644 --- a/src/renderer/component/publishForm/view.jsx +++ b/src/renderer/component/publishForm/view.jsx @@ -61,15 +61,6 @@ class PublishForm extends React.PureComponent { } handleSubmit() { - const { balance } = this.props; - const { bid } = this.state; - - if (bid > balance) { - this.handlePublishError({ message: 'insufficient funds' }); - - return; - } - this.setState({ submitting: true, }); From d8bc31847a2e620dd19529d853bd4d8ece692732 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 15 Mar 2018 18:00:11 -0400 Subject: [PATCH 3/3] change == to === --- .../component/publishForm/internal/channelSection.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/component/publishForm/internal/channelSection.jsx b/src/renderer/component/publishForm/internal/channelSection.jsx index 32e390bdb..db0b040b1 100644 --- a/src/renderer/component/publishForm/internal/channelSection.jsx +++ b/src/renderer/component/publishForm/internal/channelSection.jsx @@ -57,12 +57,12 @@ class ChannelSection extends React.PureComponent { return; } - if (newChannelBid == 0) { + if (newChannelBid === 0) { this.refs.newChannelName.showError(__('Bid value must be greater than 0.')); return; } - if (newChannelBid == balance) { + if (newChannelBid === balance) { this.refs.newChannelName.showError(__('Please decrease your bid to account for transaction fees.')); return;