Skip to content

Commit

Permalink
NTP: Fix a couple of UI issues in the New Trade Protocol (#3410)
Browse files Browse the repository at this point in the history
* Add badge support for refund agent (new arbitrator) tickets

* Fix translation typo

* Clean up arbitrator issues in translation

* Only show refund agent label to support staff

Every user should still see this role as arbitration
  • Loading branch information
ripcurlx authored and sqrrm committed Oct 15, 2019
1 parent 8c41a19 commit 1ed122c
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import bisq.core.support.dispute.arbitration.ArbitrationManager;
import bisq.core.support.dispute.mediation.MediationManager;
import bisq.core.support.dispute.refund.RefundManager;

import javax.inject.Inject;

Expand All @@ -42,6 +43,11 @@ public class SupportTicketsPresentation {
@Getter
private final BooleanProperty showOpenMediationTicketsNotification = new SimpleBooleanProperty();

@Getter
private final StringProperty numOpenRefundTickets = new SimpleStringProperty();
@Getter
private final BooleanProperty showOpenRefundTicketsNotification = new SimpleBooleanProperty();

@Getter
private final StringProperty numOpenSupportTickets = new SimpleStringProperty();
@Getter
Expand All @@ -50,14 +56,19 @@ public class SupportTicketsPresentation {
private final ArbitrationManager arbitrationManager;
@org.jetbrains.annotations.NotNull
private final MediationManager mediationManager;
private RefundManager refundManager;

@Inject
public SupportTicketsPresentation(ArbitrationManager arbitrationManager, MediationManager mediationManager) {
public SupportTicketsPresentation(ArbitrationManager arbitrationManager,
MediationManager mediationManager,
RefundManager refundManager) {
this.arbitrationManager = arbitrationManager;
this.mediationManager = mediationManager;
this.refundManager = refundManager;

arbitrationManager.getNumOpenDisputes().addListener((observable, oldValue, newValue) -> onChange());
mediationManager.getNumOpenDisputes().addListener((observable, oldValue, newValue) -> onChange());
refundManager.getNumOpenDisputes().addListener((observable, oldValue, newValue) -> onChange());
}

private void onChange() {
Expand All @@ -71,7 +82,12 @@ private void onChange() {
numOpenMediationTickets.set(String.valueOf(mediationTickets));
showOpenMediationTicketsNotification.set(mediationTickets > 0);

int supportTickets = arbitrationTickets + mediationTickets;
AtomicInteger openRefundDisputes = new AtomicInteger(refundManager.getNumOpenDisputes().get());
int refundTickets = openRefundDisputes.get();
numOpenRefundTickets.set(String.valueOf(refundTickets));
showOpenRefundTicketsNotification.set(refundTickets > 0);

int supportTickets = arbitrationTickets + mediationTickets + refundTickets;
numOpenSupportTickets.set(String.valueOf(supportTickets));
showOpenSupportTicketsNotification.set(supportTickets > 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public void cleanupDisputes() {

@Override
protected String getDisputeInfo(Dispute dispute) {
String role = Res.get("shared.arbitrator2").toLowerCase();
String link = "https://bisq.network/docs/exchange/arbitration-system";
String role = Res.get("shared.arbitrator").toLowerCase();
String link = "https://docs.bisq.network/trading-rules.html#legacy-arbitration"; //TODO needs to be created
return Res.get("support.initialInfo", role, role, link);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void cleanupDisputes() {
@Override
protected String getDisputeInfo(Dispute dispute) {
String role = Res.get("shared.refundAgent").toLowerCase();
String link = "https://bisq.network/docs/exchange/refundAgent"; //todo create link
String link = "https://docs.bisq.network/trading-rules.html#arbitration";
return Res.get("support.initialInfo", role, role, link);
}

Expand Down
9 changes: 5 additions & 4 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ shared.seller=seller
shared.buyer=buyer
shared.allEuroCountries=All Euro countries
shared.acceptedTakerCountries=Accepted taker countries
shared.arbitrator=Selected arbitrator
shared.tradePrice=Trade price
shared.tradeAmount=Trade amount
shared.tradeVolume=Trade volume
Expand Down Expand Up @@ -208,9 +207,11 @@ shared.learnMore=Learn more
shared.dismiss=Dismiss
shared.selectedArbitrator=Selected arbitrator
shared.selectedMediator=Selected mediator
shared.selectedRefundAgent=Selected arbitrator
shared.mediator=Mediator
shared.arbitrator2=Arbitrator
shared.refundAgent=Refund agent
shared.arbitrator=Arbitrator
shared.refundAgent=Arbitrator
shared.refundAgentForSupportStaff=Refund agent
shared.delayedPayoutTxId=Refund collateral transaction ID


Expand Down Expand Up @@ -984,7 +985,7 @@ support.initialInfo=Please enter a description of your problem in the text field
\t Sometimes the data directory gets corrupted and leads to strange bugs. \n\
\t See: https://docs.bisq.network/backup-recovery.html#switch-to-a-new-data-directory\n\n\
Please make yourself familiar with the basic rules for the dispute process:\n\
\t● You need to respond to the {0}}''s requests within 2 days.\n\
\t● You need to respond to the {0}''s requests within 2 days.\n\
\t● Mediators respond in between 2 days. Arbitrators respond in between 5 business days.\n\
\t● The maximum period for a dispute is 14 days.\n\
\t● You need to cooperate with the {1} and provide the information they request to make your case.\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public ArbitratorRegistrationView(ArbitratorRegistrationViewModel model,

@Override
protected String getRole() {
return Res.get("shared.arbitrator2");
return Res.get("shared.arbitrator");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public RefundAgentRegistrationView(RefundAgentRegistrationViewModel model,

@Override
protected String getRole() {
return Res.get("shared.refundAgent");
return Res.get("shared.refundAgentForSupportStaff");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,15 @@ private void addContent() {
if (dispute.getSupportType() != null) {
switch (dispute.getSupportType()) {
case ARBITRATION:
// TODO update in next release to shared.selectedArbitrator and delete shared.arbitrator entry
title = Res.get("shared.arbitrator");
title = Res.get("shared.selectedArbitrator");
break;
case MEDIATION:
title = Res.get("shared.selectedMediator");
break;
case TRADE:
break;
case REFUND:
title = Res.get("shared.refundAgent");
title = Res.get("shared.selectedRefundAgent");
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ private void updateAgentTabs() {

// We might get that method called before we have the map is filled in the arbitratorManager
if (arbitratorTab != null) {
arbitratorTab.setText(Res.get("support.tab.ArbitratorsSupportTickets", Res.get("shared.arbitrator2")).toUpperCase());
arbitratorTab.setText(Res.get("support.tab.ArbitratorsSupportTickets", Res.get("shared.arbitrator")).toUpperCase());
}
if (mediatorTab != null) {
mediatorTab.setText(Res.get("support.tab.ArbitratorsSupportTickets", Res.get("shared.mediator")).toUpperCase());
}
if (refundAgentTab != null) {
refundAgentTab.setText(Res.get("support.tab.ArbitratorsSupportTickets", Res.get("shared.refundAgent")).toUpperCase());
refundAgentTab.setText(Res.get("support.tab.ArbitratorsSupportTickets", Res.get("shared.refundAgentForSupportStaff")).toUpperCase());
}
}

Expand Down

0 comments on commit 1ed122c

Please sign in to comment.