Ensure recipients added to the cache have an identifier.

fork-5.53.8
Greyson Parrelli 2021-06-28 11:12:48 -04:00
rodzic ab5d3badc2
commit e47db0d532
1 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -100,7 +100,7 @@ public final class LiveRecipientCache {
*/
@AnyThread
public void addToCache(@NonNull Collection<Recipient> newRecipients) {
for (Recipient recipient : newRecipients) {
newRecipients.stream().filter(this::isValidForCache).forEach(recipient -> {
LiveRecipient live;
boolean needsResolve;
@ -131,7 +131,7 @@ public final class LiveRecipientCache {
}
});
}
}
});
}
@NonNull Recipient getSelf() {
@ -205,4 +205,8 @@ public final class LiveRecipientCache {
recipients.clear();
}
}
private boolean isValidForCache(@NonNull Recipient recipient) {
return !recipient.getId().isUnknown() && (recipient.hasServiceIdentifier() || recipient.getGroupId().isPresent() || recipient.hasSmsAddress());
}
}