diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java index 64697f011a0..6c91dc49182 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java @@ -43,6 +43,8 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; +import javafx.geometry.Insets; + import lombok.Getter; import org.jetbrains.annotations.NotNull; @@ -78,13 +80,17 @@ public Label getMyVoteIcon() { } else { myVoteIcon = getIcon(AwesomeIcon.THUMBS_DOWN, "dao-rejected-icon"); } + if (!isMyBallotIncluded) { + Label notIncluded = FormBuilder.getIcon(AwesomeIcon.BAN_CIRCLE); + return new Label("", new HBox(10, new StackPane(myVoteIcon, notIncluded), + getIcon(AwesomeIcon.MINUS, "dao-ignored-icon"))); + } } else { myVoteIcon = getIcon(AwesomeIcon.MINUS, "dao-ignored-icon"); - } - if (!isMyBallotIncluded) { - Label notIncluded = FormBuilder.getIcon(AwesomeIcon.BAN_CIRCLE); - return new Label("", new HBox(10, new StackPane(myVoteIcon, notIncluded), - getIcon(AwesomeIcon.MINUS, "dao-ignored-icon"))); + if (!isMyBallotIncluded) { + myVoteIcon.setPadding(new Insets(0, 0, 0, 25)); + return myVoteIcon; + } } return myVoteIcon; } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index ca5a7d4061f..a4491293a5a 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -143,6 +143,7 @@ public class VoteResultView extends ActivatableView implements D private ChangeListener selectedVoteResultListItemListener; private ResultsOfCycle resultsOfCycle; private ProposalListItem selectedProposalListItem; + private boolean isVoteIncludedInResult; /////////////////////////////////////////////////////////////////////////////////////////// @@ -253,6 +254,18 @@ private void onResultsListItemSelected(CycleListItem item) { if (item != null) { resultsOfCycle = item.getResultsOfCycle(); + // Check if my vote is included in result + isVoteIncludedInResult = false; + resultsOfCycle.getEvaluatedProposals().forEach(evProposal -> resultsOfCycle.getDecryptedVotesForCycle() + .forEach(decryptedBallotsWithMerits -> { + // Iterate through all included votes to see if any of those are ours + if (!isVoteIncludedInResult) { + isVoteIncludedInResult = bsqWalletService.isWalletTransaction(decryptedBallotsWithMerits + .getVoteRevealTxId()).isPresent(); + } + })); + + maybeShowVoteResultErrors(item.getResultsOfCycle().getCycle()); createProposalsTable(); @@ -327,10 +340,6 @@ private void onSelectProposalResultListItem(ProposalListItem item) { .findAny(); Ballot ballot = optionalBallot.orElse(null); - // Check if my vote is included in result - boolean isVoteIncludedInResult = voteListItemList.stream() - .anyMatch(voteListItem -> bsqWalletService.getTransaction(voteListItem.getBlindVoteTxId()) != null); - voteListItemList.clear(); resultsOfCycle.getEvaluatedProposals().stream() .filter(evProposal -> evProposal.getProposal().equals(selectedProposalListItem.getEvaluatedProposal().getProposal())) @@ -460,9 +469,7 @@ private void createProposalsTable() { }) .map(evaluatedProposal -> new ProposalListItem(evaluatedProposal, ballotByProposalTxIdMap.get(evaluatedProposal.getProposalTxId()), - voteListItemList.stream() - .anyMatch(voteListItem -> - bsqWalletService.getTransaction(voteListItem.getBlindVoteTxId()) != null), + isVoteIncludedInResult, bsqFormatter)) .collect(Collectors.toList())); GUIUtil.setFitToRowsForTableView(proposalsTableView, 25, 28, 6, 6);