Fix unread message counter
A bug remains when the total status of a group message is SENT, but the individual status for the client user is RECEIVED. In this case, the counter should be incremented but isn't.
This commit is contained in:
		@@ -110,8 +110,9 @@ public final class LoginCredentialProcessor implements ObjectProcessor<LoginCred
 | 
			
		||||
		logger.info(user + " successfully authenticated.");
 | 
			
		||||
		connectionManager.registerUser(user.getID(), socketID);
 | 
			
		||||
 | 
			
		||||
		// Complete the handshake
 | 
			
		||||
		writeProxy.write(socketID, user.toCommon());
 | 
			
		||||
		// Change status and notify contacts about it
 | 
			
		||||
		user.setStatus(ONLINE);
 | 
			
		||||
		UserStatusChangeProcessor.updateUserStatus(user);
 | 
			
		||||
 | 
			
		||||
		final var pendingMessages = PersistenceManager.getInstance().getPendingMessages(user, credentials.getLastSync());
 | 
			
		||||
		pendingMessages.removeIf(GroupMessage.class::isInstance);
 | 
			
		||||
@@ -145,7 +146,7 @@ public final class LoginCredentialProcessor implements ObjectProcessor<LoginCred
 | 
			
		||||
			final var gmsgCommon = gmsg.toCommon();
 | 
			
		||||
 | 
			
		||||
			// Deliver the message to the user if he hasn't received it yet
 | 
			
		||||
			if (gmsg.getMemberMessageStatus().get(user.getID()) == SENT) {
 | 
			
		||||
			if (gmsg.getCreationDate().isAfter(credentials.getLastSync()) || gmsg.getMemberMessageStatus().get(user.getID()) == SENT) {
 | 
			
		||||
				if (gmsg.getMemberMessageStatus().replace(user.getID(), RECEIVED) != RECEIVED) {
 | 
			
		||||
 | 
			
		||||
					gmsg.setLastStatusChangeDate(Instant.now());
 | 
			
		||||
@@ -187,9 +188,8 @@ public final class LoginCredentialProcessor implements ObjectProcessor<LoginCred
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Change status and notify contacts about it
 | 
			
		||||
		user.setStatus(ONLINE);
 | 
			
		||||
		UserStatusChangeProcessor.updateUserStatus(user);
 | 
			
		||||
		// Complete the handshake
 | 
			
		||||
		writeProxy.write(socketID, user.toCommon());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user