Fixed bug not updating GroupCreationTab after a new contact was added

Fixes #35
This commit is contained in:
2020-09-22 17:51:33 +02:00
parent 41f07dc452
commit c6819e637b
2 changed files with 19 additions and 3 deletions

View File

@@ -42,9 +42,10 @@ public class ContactSearchTab implements EventListener {
@FXML
private ListView<User> userList;
private Alert alert = new Alert(AlertType.CONFIRMATION);
private User currentlySelectedUser;
private final Alert alert = new Alert(AlertType.CONFIRMATION);
private static final EventBus eventBus = EventBus.getInstance();
private static final Logger logger = EnvoyLog.getLogger(ChatScene.class);
@@ -69,7 +70,7 @@ public class ContactSearchTab implements EventListener {
}
/**
* Disables the clear and search button if no text is present in the search bar.
* If text is present, sends a request to the server.
*
* @since Envoy Client v0.1-beta
*/
@@ -102,7 +103,7 @@ public class ContactSearchTab implements EventListener {
private void userListClicked() {
final var user = userList.getSelectionModel().getSelectedItem();
if (user != null) {
currentlySelectedUser = user;
currentlySelectedUser = user;
final var event = new ContactOperation(currentlySelectedUser, ElementOperation.ADD);
// Sends the event to the server
eventBus.dispatch(new SendEvent(event));