Fix situation where group thread does not yet exist.

fork-5.53.8
Alan Evans 2020-11-17 15:52:38 -04:00 zatwierdzone przez GitHub
rodzic 8df6e95781
commit 6e5abc92a0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -24,7 +24,9 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
public class ReviewUtil {
public final class ReviewUtil {
private ReviewUtil() { }
private static final long TIMEOUT = TimeUnit.HOURS.toMillis(24);
@ -91,9 +93,13 @@ public class ReviewUtil {
@WorkerThread
public static @NonNull List<MessageRecord> getProfileChangeRecordsForGroup(@NonNull Context context, @NonNull GroupId.V2 groupId) {
RecipientId recipientId = DatabaseFactory.getRecipientDatabase(context).getByGroupId(groupId).get();
long threadId = Objects.requireNonNull(DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipientId));
Long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipientId);
return DatabaseFactory.getSmsDatabase(context).getProfileChangeDetailsRecords(threadId, System.currentTimeMillis() - TIMEOUT);
if (threadId == null) {
return Collections.emptyList();
} else {
return DatabaseFactory.getSmsDatabase(context).getProfileChangeDetailsRecords(threadId, System.currentTimeMillis() - TIMEOUT);
}
}
@WorkerThread