Fixed bug not enabling the post-button when an attachment is present
This commit is contained in:
parent
ec700685ac
commit
5109605415
@ -355,6 +355,7 @@ public final class ChatScene implements Restorable {
|
|||||||
try {
|
try {
|
||||||
final var fileBytes = Files.readAllBytes(file.toPath());
|
final var fileBytes = Files.readAllBytes(file.toPath());
|
||||||
pendingAttachment = new Attachment(fileBytes, type);
|
pendingAttachment = new Attachment(fileBytes, type);
|
||||||
|
checkPostConditions(false);
|
||||||
// Setting the preview image as image of the attachmentView
|
// Setting the preview image as image of the attachmentView
|
||||||
if (type == AttachmentType.PICTURE)
|
if (type == AttachmentType.PICTURE)
|
||||||
attachmentView.setImage(new Image(new ByteArrayInputStream(fileBytes), DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE, true, true));
|
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());
|
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPostConditions(boolean sendKeyPressed) {
|
private void checkPostConditions(boolean postMessage) {
|
||||||
if (!postingPermanentlyDisabled) {
|
if (!postingPermanentlyDisabled) {
|
||||||
if (!postButton.isDisabled() && sendKeyPressed) postMessage();
|
if (!postButton.isDisabled() && postMessage) postMessage();
|
||||||
postButton.setDisable(messageTextArea.getText().isBlank() && pendingAttachment == null || currentChat == null);
|
postButton.setDisable(messageTextArea.getText().isBlank() && pendingAttachment == null || currentChat == null);
|
||||||
} else {
|
} else {
|
||||||
final var noMoreMessaging = "Go online to send messages";
|
final var noMoreMessaging = "Go online to send messages";
|
||||||
|
Reference in New Issue
Block a user