Apply suggestions from code review
Co-authored-by: CyB3RC0nN0R <CyB3RC0nN0R@users.noreply.github.com>
This commit is contained in:
		@@ -115,14 +115,14 @@ public class Chat implements Serializable {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Increments the unreadMessagesAmount by 1
 | 
			
		||||
	 * Increments the amount of unread messages.
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @since Envoy Client v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public void incrementUnreadAmount() { unreadAmount++; }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @return the amount of unreadMesages in this chat
 | 
			
		||||
	 * @return the amount of unread mesages in this chat
 | 
			
		||||
	 * @since Envoy Client v0.1-beta
 | 
			
		||||
	 */
 | 
			
		||||
	public int getUnreadAmount() { return unreadAmount; }
 | 
			
		||||
 
 | 
			
		||||
@@ -50,6 +50,7 @@ public class GroupChat extends Chat {
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		super.unreadAmount = 0;
 | 
			
		||||
		unreadAmount = 0;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -166,7 +166,7 @@ public final class ChatScene implements Restorable {
 | 
			
		||||
					.stream()
 | 
			
		||||
					.filter(c -> c.getRecipient().getID() == e.getID())
 | 
			
		||||
					.findAny()
 | 
			
		||||
					.map(u -> u.getRecipient())
 | 
			
		||||
					.map(Chat::getRecipient)
 | 
			
		||||
					.ifPresent(u -> { ((User) u).setStatus(e.get()); Platform.runLater(userList::refresh); }));
 | 
			
		||||
 | 
			
		||||
		// Listen to contacts changes
 | 
			
		||||
@@ -204,7 +204,7 @@ public final class ChatScene implements Restorable {
 | 
			
		||||
		this.client			= client;
 | 
			
		||||
		this.writeProxy		= writeProxy;
 | 
			
		||||
 | 
			
		||||
		userList.setItems(FXCollections.observableList(localDB.getChats().stream().collect(Collectors.toList())));
 | 
			
		||||
		userList.setItems(FXCollections.observableList(localDB.getChats()));
 | 
			
		||||
		contactLabel.setText(localDB.getUser().getName());
 | 
			
		||||
		MessageControl.setUser(localDB.getUser());
 | 
			
		||||
		if (!client.isOnline()) updateInfoLabel("You are offline", "infoLabel-info");
 | 
			
		||||
@@ -462,8 +462,7 @@ public final class ChatScene implements Restorable {
 | 
			
		||||
			currentChat.insert(message);
 | 
			
		||||
			// Moving currentChat to the top
 | 
			
		||||
			Platform.runLater(() -> {
 | 
			
		||||
				userList.getItems().remove(currentChat);
 | 
			
		||||
				userList.getItems().add(0, currentChat);
 | 
			
		||||
				userList.getItems().add(0, userList.getItems().remove(currentChat));
 | 
			
		||||
				userList.getSelectionModel().select(0);
 | 
			
		||||
				localDB.getChats().remove(currentChat);
 | 
			
		||||
				localDB.getChats().add(0, currentChat);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user