Skip to content
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

Only use InputValidation when formatting voting stake #4090

Merged
merged 1 commit into from
Mar 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@
import bisq.core.locale.Res;
import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;
import bisq.core.util.coin.BsqFormatter;
import bisq.core.util.ParsingUtils;
import bisq.core.util.coin.BsqFormatter;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;

import bisq.common.UserThread;
import bisq.common.app.DevEnv;
Expand Down Expand Up @@ -554,6 +555,7 @@ private void updateViews() {
if (optionalMyVote.isPresent()) {
MyVote myVote = optionalMyVote.get();
Coin stake = Coin.valueOf(myVote.getBlindVote().getStake());
stakeInputTextField.setValidator(new InputValidator());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be set at line 676 instead of

        stakeInputTextField.setValidator(new BsqValidator(bsqFormatter));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the validator there is fine. Just after submitting the vote the value entered is formatted with BSQ in the end which causes the original validator to fail. I think it is good that it is formatted with the code in this case so I didn't remove the formatting, but decided to adapt the validator.

stakeInputTextField.setText(bsqFormatter.formatCoinWithCode(stake));

if (myVote.getBlindVoteTxId() != null) {
Expand Down