add system message only once when dispute is opened

This commit is contained in:
woodser 2025-09-27 00:40:23 -04:00
parent 457518e3a9
commit 6d17c9f44c
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF

View file

@ -430,20 +430,24 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
// save state // save state
persistNow(null); persistNow(null);
String disputeInfo = getDisputeInfo(dispute); // add dispute system message once
String sysMsg = dispute.isSupportTicket() ? boolean hasSystemMessage = dispute.getChatMessages().stream().anyMatch(ChatMessage::isSystemMessage);
Res.get("support.youOpenedTicket", disputeInfo, Version.VERSION) : if (!hasSystemMessage) {
Res.get("support.youOpenedDispute", disputeInfo, Version.VERSION); String disputeInfo = getDisputeInfo(dispute);
String sysMsg = dispute.isSupportTicket() ?
ChatMessage chatMessage = new ChatMessage( Res.get("support.youOpenedTicket", disputeInfo, Version.VERSION) :
getSupportType(), Res.get("support.youOpenedDispute", disputeInfo, Version.VERSION);
dispute.getTradeId(), ChatMessage chatMessage = new ChatMessage(
keyRing.getPubKeyRing().hashCode(), getSupportType(),
false, dispute.getTradeId(),
Res.get("support.systemMsg", sysMsg), keyRing.getPubKeyRing().hashCode(),
p2PService.getAddress()); false,
chatMessage.setSystemMessage(true); Res.get("support.systemMsg", sysMsg),
dispute.addAndPersistChatMessage(chatMessage); p2PService.getAddress());
chatMessage.setSystemMessage(true);
dispute.addAndPersistChatMessage(chatMessage);
}
ChatMessage chatMessage = dispute.getChatMessages().get(dispute.getChatMessages().size() - 1); // last message // TODO: why can't this be assigned to local variable above?
// try to import latest multisig info // try to import latest multisig info
try { try {