Fixed bug not scrolling to the correct message
This commit is contained in:
		@@ -184,7 +184,7 @@ public final class ChatScene implements Restorable {
 | 
			
		||||
			switch (e.getOperationType()) {
 | 
			
		||||
				case ADD:
 | 
			
		||||
					localDB.getUsers().put(contact.getName(), contact);
 | 
			
		||||
					Chat chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
 | 
			
		||||
					final Chat chat = contact instanceof User ? new Chat(contact) : new GroupChat(client.getSender(), contact);
 | 
			
		||||
					Platform.runLater(() -> chatList.getItems().add(chat));
 | 
			
		||||
					break;
 | 
			
		||||
				case REMOVE:
 | 
			
		||||
@@ -240,7 +240,7 @@ public final class ChatScene implements Restorable {
 | 
			
		||||
			currentChat = localDB.getChat(user.getID()).get();
 | 
			
		||||
 | 
			
		||||
			messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
 | 
			
		||||
			final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount() - 1;
 | 
			
		||||
			final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount();
 | 
			
		||||
			messageList.scrollTo(scrollIndex);
 | 
			
		||||
			logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
 | 
			
		||||
			deleteContactMenuItem.setText("Delete " + user.getName());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user