Fixed bug not enabling the post-button when an attachment is present
This commit is contained in:
parent
c0f4a8e212
commit
176f6c6463
@ -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";
|
||||
|
Reference in New Issue
Block a user