Merge pull request #6136 from jmacxx/refundagent_prevent_multiple_payout_prompt

Prevent multiple payout screens when agent repeat clicks on close ticket.
This commit is contained in:
Christoph Atteneder 2022-04-07 19:57:32 +02:00 committed by GitHub
commit 28e51b11f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,6 +132,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
private ChangeListener<Toggle> tradeAmountToggleGroupListener;
private ChangeListener<String> compensationOrPenaltyListener;
private boolean updatingUi = false;
private Popup payoutPromptOnDisplay = null;
///////////////////////////////////////////////////////////////////////////////////////////
// Public API
@ -711,7 +712,10 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
.closeButtonText(Res.get("shared.cancel"))
.show();
}
if (payoutPromptOnDisplay != null) {
log.warn("The payout prompt is already on display, we do not show another copy of it.");
return;
}
Coin buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();
String buyerPayoutAddressString = contract.getBuyerPayoutAddressString();
Coin sellerPayoutAmount = disputeResult.getSellerPayoutAmount();
@ -736,8 +740,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
sellerPayoutAddressString);
}
if (outputAmount.isPositive()) {
new Popup().width(900)
.headLine(Res.get("disputeSummaryWindow.close.txDetails.headline"))
payoutPromptOnDisplay = new Popup().width(900);
payoutPromptOnDisplay.headLine(Res.get("disputeSummaryWindow.close.txDetails.headline"))
.confirmation(Res.get("disputeSummaryWindow.close.txDetails",
formatter.formatCoinWithCode(inputAmount),
buyerDetails,
@ -747,6 +751,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
vkb))
.actionButtonText(Res.get("shared.yes"))
.onAction(() -> {
payoutPromptOnDisplay = null;
doPayout(buyerPayoutAmount,
sellerPayoutAmount,
fee,
@ -755,6 +760,9 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
resultHandler);
})
.closeButtonText(Res.get("shared.cancel"))
.onClose(() -> {
payoutPromptOnDisplay = null;
})
.show();
} else {
// No payout will be made