]> nmode's Git Repositories - signal-cli/commitdiff
Fix to always update recipientsMerged map when merging recipients
authorAsamK <asamk@gmx.de>
Fri, 3 Dec 2021 13:25:07 +0000 (14:25 +0100)
committerAsamK <asamk@gmx.de>
Fri, 3 Dec 2021 13:25:07 +0000 (14:25 +0100)
lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java

index 16a9f4cbbd6049d92a06b0f66d162c00665d41f8..10f67c2aea46f868becd12b087db610ff2524419 100644 (file)
@@ -309,9 +309,6 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
         final Pair<RecipientId, Optional<RecipientId>> pair;
         synchronized (recipients) {
             pair = resolveRecipientLocked(address, isHighTrust);
-            if (pair.second().isPresent()) {
-                recipientsMerged.put(pair.second().get(), pair.first());
-            }
         }
 
         if (pair.second().isPresent()) {
@@ -378,6 +375,7 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
         logger.debug("Got separate recipients for high trust number and uuid, need to merge them");
         updateRecipientAddressLocked(byUuid.get().getRecipientId(), address);
         mergeRecipientsLocked(byUuid.get().getRecipientId(), byNumber.get().getRecipientId());
+        recipientsMerged.put(byNumber.get().getRecipientId(), byUuid.get().getRecipientId());
         return new Pair<>(byUuid.get().getRecipientId(), byNumber.map(Recipient::getRecipientId));
     }