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

Allow dispute to be closed if trade has paid out #6015

Merged
merged 1 commit into from Feb 1, 2022
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 @@ -399,7 +399,9 @@ protected void activateReOpenDisputeListener() {
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();
}
Expand Down Expand Up @@ -516,14 +518,16 @@ protected void reOpenDisputeFromButton() {
// 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) {
Expand Down