Fix Bug Showing Incorrect User Statuses (#78)

Reviewed-on: https://git.kske.dev/zdm/envoy/pulls/78
Reviewed-by: kske <kai@kske.dev>
Reviewed-by: DieGurke <maxi@kske.dev>
This commit is contained in:
Leon Hofmeister 2020-10-04 21:53:58 +02:00
parent 99867eb23a
commit da6bdafc68
Signed by: Käfer & Engelbart Git
GPG Key ID: 70F2F9206EDC1FCE
2 changed files with 4 additions and 3 deletions

View File

@ -135,7 +135,7 @@ public class Chat implements Serializable {
*
* @since Envoy Client v0.1-beta
*/
public void incrementUnreadAmount() { unreadAmount++; }
public void incrementUnreadAmount() { ++unreadAmount; }
/**
* @return the amount of unread messages in this chat

View File

@ -155,8 +155,9 @@ public final class LocalDB implements EventListener {
users.put(user.getName(), user);
// Synchronize user status data
for (final var contact : users.values())
if (contact instanceof User) getChat(contact.getID()).ifPresent(chat -> { ((User) chat.getRecipient()).setStatus(contact.getStatus()); });
for (final var contact : user.getContacts())
if (contact instanceof User)
getChat(contact.getID()).ifPresent(chat -> { ((User) chat.getRecipient()).setStatus(((User) contact).getStatus()); });
// Create missing chats
user.getContacts()