From 5e10ecb466bbe22f2e2025cc34ad0ec211ac5956 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 29 Jan 2019 15:35:31 +0100 Subject: [PATCH 1/3] Reset UI at button click instead of callback from publishing We reset UI without waiting for callback as callback might be slow and then the user could create multiple proposals. --- .../main/dao/governance/make/MakeProposalView.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index 9b946631fd8..02ad70fab41 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -238,13 +238,16 @@ private void doPublishMyProposal(Proposal proposal, Transaction transaction) { daoFacade.publishMyProposal(proposal, transaction, () -> { - if (proposalDisplay != null) - proposalDisplay.clearForm(); - proposalTypeComboBox.getSelectionModel().clearSelection(); if (!DevEnv.isDevMode()) new Popup<>().confirmation(Res.get("dao.tx.published.success")).show(); }, errorMessage -> new Popup<>().warning(errorMessage).show()); + + // We reset UI without waiting for callback as callback might be slow and then the user could create multiple + // proposals. + if (proposalDisplay != null) + proposalDisplay.clearForm(); + proposalTypeComboBox.getSelectionModel().clearSelection(); } @Nullable @@ -377,4 +380,3 @@ private void updateButtonState() { makeProposalButton.setDisable(!inputsValid.get()); } } - From 2314889a2557bf7debb530273fa8e5eb6d34430d Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 29 Jan 2019 15:45:43 +0100 Subject: [PATCH 2/3] Reset UI at button click instead of callback from publishing We reset UI without waiting for callback as callback might be slow and then the user could create multiple votes. --- .../main/dao/governance/proposals/ProposalsView.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 76ce50cbbce..338a8ca05b6 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -514,17 +514,19 @@ private void publishBlindVote(Coin stake) { voteButtonInfoLabel.setText(Res.get("dao.blindVote.startPublishing")); daoFacade.publishBlindVote(stake, () -> { - voteButtonBusyAnimation.stop(); - voteButtonInfoLabel.setText(""); if (!DevEnv.isDevMode()) new Popup<>().feedback(Res.get("dao.blindVote.success")).show(); - - updateViews(); }, exception -> { voteButtonBusyAnimation.stop(); voteButtonInfoLabel.setText(""); new Popup<>().warning(exception.toString()).show(); }); + + // We reset UI without waiting for callback as callback might be slow and then the user could click + // multiple times. + voteButtonBusyAnimation.stop(); + voteButtonInfoLabel.setText(""); + updateViews(); } private void updateStateAfterVote() { From 40e3d257d3185721c56bf61621b4ace26ec7bfc9 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 29 Jan 2019 15:49:19 +0100 Subject: [PATCH 3/3] Add dontShowAgain flag to popup In case the user manage to vote multiple times we dont show a error popup but only a warning popup and add the dont show again checkbox. It is not possible to do that in the UI but not invalid from the DAO rules. --- .../main/dao/governance/proposals/ProposalsView.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 338a8ca05b6..0fd5b0675ce 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -50,6 +50,7 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; +import bisq.core.user.Preferences; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; @@ -111,6 +112,7 @@ public class ProposalsView extends ActivatableView implements Bs private final PhasesView phasesView; private final DaoStateService daoStateService; private final ChangeParamValidator changeParamValidator; + private final Preferences preferences; private final BsqFormatter bsqFormatter; private final BSFormatter btcFormatter; @@ -154,6 +156,7 @@ private ProposalsView(DaoFacade daoFacade, PhasesView phasesView, DaoStateService daoStateService, ChangeParamValidator changeParamValidator, + Preferences preferences, BsqFormatter bsqFormatter, BSFormatter btcFormatter) { this.daoFacade = daoFacade; @@ -161,6 +164,7 @@ private ProposalsView(DaoFacade daoFacade, this.phasesView = phasesView; this.daoStateService = daoStateService; this.changeParamValidator = changeParamValidator; + this.preferences = preferences; this.bsqFormatter = bsqFormatter; this.btcFormatter = btcFormatter; } @@ -615,7 +619,9 @@ private void updateViews() { } else { String msg = "We found multiple MyVote entries in that cycle. That is not supported by the UI."; log.warn(msg); - new Popup<>().error(msg).show(); + String id = "multipleVotes"; + if (preferences.showAgain(id)) + new Popup<>().warning(msg).dontShowAgainId(id).show(); } voteButton.setVisible(false); voteButton.setManaged(false);