Skip to content

Commit

Permalink
Merge pull request #4615 from chimp1984/fix-trade-protocol-check-at-r…
Browse files Browse the repository at this point in the history
…efund-agent-close

Fix trade protocol check for refund agent ticket close
  • Loading branch information
ripcurlx authored Oct 20, 2020
2 parents ebe4618 + f2b41d8 commit 50e2c89
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

import bisq.network.p2p.NodeAddress;

import bisq.common.app.Version;
import bisq.common.crypto.KeyRing;
import bisq.common.crypto.PubKeyRing;
import bisq.common.util.Utilities;
Expand Down Expand Up @@ -475,16 +474,6 @@ protected void reOpenDisputeFromButton() {

protected abstract void handleOnSelectDispute(Dispute dispute);

protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
if (protocolVersion == Version.TRADE_PROTOCOL_VERSION) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox())
.show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}

protected void reOpenDispute() {
if (selectedDispute != null) {
selectedDispute.setIsClosed(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ protected void setupTable() {
tableView.getColumns().add(getAlertColumn());
}

protected abstract void onCloseDispute(Dispute dispute);


///////////////////////////////////////////////////////////////////////////////////////////
// Private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.main.support.dispute.agent.arbitration;

import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.ContractWindow;
import bisq.desktop.main.overlays.windows.DisputeSummaryWindow;
import bisq.desktop.main.overlays.windows.TradeDetailsWindow;
Expand All @@ -26,6 +27,7 @@
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.dao.DaoFacade;
import bisq.core.locale.Res;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeSession;
Expand Down Expand Up @@ -84,4 +86,17 @@ protected SupportType getType() {
protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {
return new ArbitrationSession(dispute, disputeManager.isTrader(dispute));
}

@Override
protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
// Only cases with protocolVersion 1 are candidates for legacy arbitration.
// This code path is not tested and it is not assumed that it is still be used as old arbitrators would use
// their old Bisq version if still cases are pending.
if (protocolVersion == 1) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {

@Override
protected void onCloseDispute(Dispute dispute) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox())
.show(dispute);
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package bisq.desktop.main.support.dispute.agent.refund;

import bisq.desktop.common.view.FxmlView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.ContractWindow;
import bisq.desktop.main.overlays.windows.DisputeSummaryWindow;
import bisq.desktop.main.overlays.windows.TradeDetailsWindow;
Expand All @@ -26,6 +27,7 @@
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.alert.PrivateNotificationManager;
import bisq.core.dao.DaoFacade;
import bisq.core.locale.Res;
import bisq.core.support.SupportType;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeSession;
Expand Down Expand Up @@ -84,4 +86,15 @@ protected SupportType getType() {
protected DisputeSession getConcreteDisputeChatSession(Dispute dispute) {
return new RefundSession(dispute, disputeManager.isTrader(dispute));
}

@Override
protected void onCloseDispute(Dispute dispute) {
long protocolVersion = dispute.getContract().getOfferPayload().getProtocolVersion();
// Refund agent was introduced with protocolVersion version 2. We do not support old trade protocol cases.
if (protocolVersion >= 2) {
disputeSummaryWindow.onFinalizeDispute(() -> chatView.removeInputBox()).show(dispute);
} else {
new Popup().warning(Res.get("support.wrongVersion", protocolVersion)).show();
}
}
}

0 comments on commit 50e2c89

Please sign in to comment.