Reduce number of db calls to getGroup.

This commit is contained in:
Clark
2023-05-11 13:20:15 -04:00
committed by Greyson Parrelli
parent 6da36fe098
commit e9f1f781e1
14 changed files with 105 additions and 52 deletions

View File

@@ -84,7 +84,8 @@ object RecipientDatabaseTestUtils {
extras: Recipient.Extras? = null,
hasGroupsInCommon: Boolean = false,
badges: List<Badge> = emptyList(),
isReleaseChannel: Boolean = false
isReleaseChannel: Boolean = false,
isActive: Boolean = true
): Recipient = Recipient(
recipientId,
RecipientDetails(
@@ -155,7 +156,8 @@ object RecipientDatabaseTestUtils {
isHidden = false
),
participants,
isReleaseChannel
isReleaseChannel,
isActive
),
resolved
)

View File

@@ -104,7 +104,7 @@ class GroupsV2StateProcessorTest {
val data = givenData(init)
every { groupTable.getGroup(any<GroupId.V2>()) } returns data.groupRecord
every { groupTable.isUnknownGroup(any()) } returns !data.groupRecord.isPresent
every { groupTable.isUnknownGroup(any<GroupId>()) } returns !data.groupRecord.isPresent
data.serverState?.let { serverState ->
val testPartial = object : PartialDecryptedGroup(null, serverState, null, null) {
@@ -305,7 +305,7 @@ class GroupsV2StateProcessorTest {
apiCallParameters(2, true)
}
every { groupTable.isUnknownGroup(any()) } returns true
every { groupTable.isUnknownGroup(any<GroupId>()) } returns true
val result = processor.updateLocalGroupToRevision(2, 0, DecryptedGroupChange.getDefaultInstance())