Fix situation where group thread does not yet exist.
This commit is contained in:
parent
8df6e95781
commit
6e5abc92a0
1 changed files with 9 additions and 3 deletions
|
@ -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,10 +93,14 @@ 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);
|
||||
|
||||
if (threadId == null) {
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
return DatabaseFactory.getSmsDatabase(context).getProfileChangeDetailsRecords(threadId, System.currentTimeMillis() - TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static int getGroupsInCommonCount(@NonNull Context context, @NonNull RecipientId recipientId) {
|
||||
|
|
Loading…
Add table
Reference in a new issue