close chat when ticket is closed

This commit is contained in:
jmacxx 2021-04-01 14:06:58 -05:00
parent bf81c03708
commit 23535de418
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B
3 changed files with 12 additions and 1 deletions

View File

@ -2003,6 +2003,10 @@ textfield */
-fx-font-size: 0.846em;
}
.dispute-chat-border {
-fx-background-color: -bs-color-blue-5;
}
/********************************************************************************************************************
* *
* DAO *

View File

@ -46,6 +46,8 @@ import javafx.scene.layout.StackPane;
import javafx.beans.value.ChangeListener;
import lombok.Getter;
public class DisputeChatPopup {
public interface ChatCallback {
void onCloseDisputeFromChatWindow(Dispute dispute);
@ -60,6 +62,7 @@ public class DisputeChatPopup {
private double chatPopupStageYPosition = -1;
private ChangeListener<Number> xPositionListener;
private ChangeListener<Number> yPositionListener;
@Getter private Dispute selectedDispute;
DisputeChatPopup(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
CoinFormatter formatter,
@ -78,10 +81,12 @@ public class DisputeChatPopup {
public void closeChat() {
if (chatPopupStage != null)
chatPopupStage.close();
selectedDispute = null;
}
public void openChat(Dispute selectedDispute, DisputeSession concreteDisputeSession, String counterpartyName) {
closeChat();
this.selectedDispute = selectedDispute;
selectedDispute.getChatMessages().forEach(m -> m.setWasDisplayed(true));
disputeManager.requestPersistence();
@ -96,7 +101,7 @@ public class DisputeChatPopup {
AnchorPane.setRightAnchor(chatView, 10d);
AnchorPane.setTopAnchor(chatView, -20d);
AnchorPane.setBottomAnchor(chatView, 10d);
pane.setStyle("-fx-background-color: -bs-color-blue-5");
pane.getStyleClass().add("dispute-chat-border");
Button closeDisputeButton = null;
if (!selectedDispute.isClosed() && !disputeManager.isTrader(selectedDispute)) {
closeDisputeButton = new AutoTooltipButton(Res.get("support.closeTicket"));

View File

@ -1366,6 +1366,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
setText(newValue ? Res.get("support.closed") : Res.get("support.open"));
if (getTableRow() != null)
getTableRow().setOpacity(newValue && item.getBadgeCountProperty().get() == 0 ? 0.4 : 1);
if (item.isClosed() && item == chatPopup.getSelectedDispute())
chatPopup.closeChat(); // close the chat popup when the associated ticket is closed
};
closedProperty = item.isClosedProperty();
closedProperty.addListener(listener);