Merge pull request #6015 from jmacxx/fix_issue_6008

Allow dispute to be closed if trade has paid out
This commit is contained in:
Christoph Atteneder 2022-02-01 10:21:38 +01:00 committed by GitHub
commit a038d3d861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -399,7 +399,9 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
ObservableList<ChatMessage> chatMessages = dispute.getChatMessages();
// If last message is not a result message we re-open as we might have received a new message from the
// trader/mediator/arbitrator who has reopened the case
if (!chatMessages.isEmpty() && !chatMessages.get(chatMessages.size() - 1).isResultMessage(dispute)) {
if (!chatMessages.isEmpty() &&
!chatMessages.get(chatMessages.size() - 1).isResultMessage(dispute) &&
dispute.unreadMessageCount(senderFlag()) > 0) {
onSelectDispute(dispute);
reOpenDispute();
}
@ -516,14 +518,16 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> implements
// only allow them to close the dispute if the trade is paid out
// the reason for having this is that sometimes traders end up with closed disputes that are not "closed" @pazza
protected void closeDisputeFromButton() {
Optional<Trade> tradeOptional = disputeManager.findTrade(selectedDispute);
if (tradeOptional.isPresent() && tradeOptional.get().getPayoutTxId() != null && tradeOptional.get().getPayoutTxId().length() > 0) {
selectedDispute.setIsClosed();
disputeManager.requestPersistence();
onSelectDispute(selectedDispute);
} else {
new Popup().warning(Res.get("support.warning.traderCloseOwnDisputeWarning")).show();
}
disputeManager.findTrade(selectedDispute).ifPresent(
(trade) -> {
if (trade.isFundsLockedIn()) {
new Popup().warning(Res.get("support.warning.traderCloseOwnDisputeWarning")).show();
} else {
selectedDispute.setIsClosed();
disputeManager.requestPersistence();
onSelectDispute(selectedDispute);
}
});
}
protected void handleOnProcessDispute(Dispute dispute) {