-
-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alert user if insufficient tokens for tip #3058
Conversation
app/assets/onepager/js/send.js
Outdated
denomFactor = Math.pow(10, tokenDetails.decimals); | ||
|
||
check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/onepager/js/send.js
Outdated
|
||
check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, | ||
amount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/pages/new_bounty.js
Outdated
if (!isETH) { | ||
check_balance_and_alert_user_if_not_enough(tokenAddress, amount); | ||
check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/pages/new_bounty.js
Outdated
check_balance_and_alert_user_if_not_enough(tokenAddress, amount); | ||
check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, | ||
amount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/shared.js
Outdated
@@ -1336,3 +1336,29 @@ function shuffleArray(array) { | |||
} | |||
return array; | |||
} | |||
|
|||
function check_balance_and_alert_user_if_not_enough( | |||
tokenAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4. (indent)
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/shared.js
Outdated
|
||
function check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, | ||
amount, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4. (indent)
Trailing spaces not allowed. (no-trailing-spaces)
app/assets/v2/js/shared.js
Outdated
function check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, | ||
amount, | ||
msg='You do not have enough tokens to perform this action.') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4. (indent)
Infix operators must be spaced. (space-infix-ops)
app/assets/v2/js/shared.js
Outdated
var balance_rounded = Math.round(balance * 10) / 10; | ||
|
||
if (parseFloat(amount) > balance) { | ||
var msg1 = gettext(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon. (semi)
app/assets/v2/js/shared.js
Outdated
} | ||
}); | ||
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon. (no-extra-semi)
79cf7dc
to
88c9817
Compare
app/assets/v2/js/shared.js
Outdated
function check_balance_and_alert_user_if_not_enough( | ||
tokenAddress, | ||
amount, | ||
msg='You do not have enough tokens to perform this action.') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Infix operators must be spaced. (space-infix-ops)
88c9817
to
7843701
Compare
Codecov Report
@@ Coverage Diff @@
## master #3058 +/- ##
==========================================
- Coverage 29.77% 29.72% -0.05%
==========================================
Files 180 180
Lines 13734 13734
Branches 1842 1842
==========================================
- Hits 4089 4083 -6
- Misses 9507 9513 +6
Partials 138 138
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #3058 +/- ##
==========================================
- Coverage 30.37% 30.33% -0.04%
==========================================
Files 206 206
Lines 16404 16404
Branches 2156 2156
==========================================
- Hits 4982 4976 -6
- Misses 11242 11248 +6
Partials 180 180
Continue to review full report at Codecov.
|
2e67def
to
f9898d0
Compare
f9898d0
to
b679fbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dylanjw could you
fix travis CI failures- throw in a recording of the fix
And if you are up for making the code base a lil better
L81 - L96. Update var
with let
/ const
@thelostone-mc The CI is throwing the following error:
I dont think this is related to the changes in the PR. |
@dylanjw My bad ! I'll fix up travis ^_^ |
migration issues have been resolved upstream |
93d5026
to
4c3506c
Compare
After testing this again recently it looks like there has been a regression with Eth based tips. When I first worked on this, I think insufficient Eth had a warning already, and I just needed to implement the alternative token warning. Now Im only getting the warning for the alternative token. I will include a fix for the insufficient Eth in this PR. |
The regression when sending an ETH tip looks a little deeper than I anticipated. I opened this issue: #3877. Im surprised by that issue, because there looks like a lot of areas where that issue could be breaking things. |
6aace8f
to
34a9ccb
Compare
While it is decided if #3877 is a bug or not, I have updated this PR to normalize 0x0 to the full length address. Here are screenshots of the tip error message displaying with Eth and with an alternate token: |
@dylanjw will test this out but could you fix the CI errors ? |
ee6f0fc
to
69a9ae0
Compare
@thelostone-mc Im getting a CI error from the code coverage calculation. The file with the change in coverage looks unrelated to my changes. |
Also, normalize 0x0 to full legnth
69a9ae0
to
978207a
Compare
@thelostone-mc Ready to merge |
Description
See #2250
Checklist
Affected core subsystem(s)
ui
Testing
I tested locally with docker. I both test the validation message on sending a tip, and on submitting a bounty.
Refers/Fixes
Fixes #2250