diff --git a/client/src/main/java/envoy/client/ui/controller/ChatScene.java b/client/src/main/java/envoy/client/ui/controller/ChatScene.java index c431aad..c261ed6 100644 --- a/client/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/client/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -355,6 +355,7 @@ public final class ChatScene implements Restorable { try { final var fileBytes = Files.readAllBytes(file.toPath()); pendingAttachment = new Attachment(fileBytes, type); + checkPostConditions(false); // Setting the preview image as image of the attachmentView if (type == AttachmentType.PICTURE) attachmentView.setImage(new Image(new ByteArrayInputStream(fileBytes), DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, true, true)); @@ -413,9 +414,9 @@ public final class ChatScene implements Restorable { || !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()); } - private void checkPostConditions(boolean sendKeyPressed) { + private void checkPostConditions(boolean postMessage) { if (!postingPermanentlyDisabled) { - if (!postButton.isDisabled() && sendKeyPressed) postMessage(); + if (!postButton.isDisabled() && postMessage) postMessage(); postButton.setDisable(messageTextArea.getText().isBlank() && pendingAttachment == null || currentChat == null); } else { final var noMoreMessaging = "Go online to send messages";