Added option to disable attachments and groups on both client and server

This commit is contained in:
delvh
2020-08-22 18:14:26 +02:00
parent eb4e421974
commit c784ebb787
15 changed files with 219 additions and 83 deletions

View File

@ -87,6 +87,12 @@ public final class ChatScene implements Restorable {
@FXML
private Button rotateButton;
@FXML
private Button messageSearchButton;
@FXML
private Button newGroupButton;
@FXML
private TextArea messageTextArea;
@ -108,9 +114,6 @@ public final class ChatScene implements Restorable {
@FXML
private Label topBarStatusLabel;
@FXML
private Button messageSearchButton;
@FXML
private ImageView clientProfilePic;
@ -129,7 +132,8 @@ public final class ChatScene implements Restorable {
private AudioRecorder recorder;
private boolean recording;
private Attachment pendingAttachment;
private boolean postingPermanentlyDisabled;
private boolean postingPermanentlyDisabled;
private final SystemCommandsMap messageTextAreaCommands = new SystemCommandsMap();
@ -237,6 +241,21 @@ public final class ChatScene implements Restorable {
break;
}
});
// Disable attachment button if server says attachments will be filtered out
eventBus.register(NoAttachments.class, e -> {
Platform.runLater(() -> {
attachmentButton.setDisable(true);
voiceButton.setDisable(true);
final var alert = new Alert(AlertType.ERROR);
alert.setTitle("No attachments possible");
alert.setHeaderText("Your current server does not support attachments.");
alert.setContentText("If this is unplanned, please contact your server administrator.");
alert.showAndWait();
});
});
eventBus.register(GroupCreationResult.class, e -> Platform.runLater(() -> { newGroupButton.setDisable(!e.get()); }));
}
/**