Skip to content

Commit

Permalink
Merge branch 'release/android-cycle-4.6' into fix/login-after-session…
Browse files Browse the repository at this point in the history
…-expire
  • Loading branch information
MohamadJaara authored Sep 25, 2024
2 parents 2809ff3 + c0869d4 commit 4466e93
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type = excluded.type,
team_id = excluded.team_id,
mls_group_id = excluded.mls_group_id,
mls_epoch = excluded.mls_epoch,
mls_group_state = excluded.mls_group_state,
protocol = excluded.protocol,
muted_status = excluded.muted_status,
muted_time = excluded.muted_time,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ class ConversationDAOTest : BaseDatabaseTest() {
assertNull(result)
}

@Test
fun givenExistingConversation_WhenReinserting_ThenGroupStateIsUpdated() = runTest {
conversationDAO.insertConversation(conversationEntity2)
conversationDAO.insertConversation(conversationEntity2.copy(
protocolInfo = mlsProtocolInfo1.copy(
groupState = ConversationEntity.GroupState.PENDING_JOIN
)
))
val result = conversationDAO.getConversationByQualifiedID(conversationEntity2.id)
assertEquals(ConversationEntity.GroupState.PENDING_JOIN, (result?.protocolInfo as ConversationEntity.ProtocolInfo.MLS).groupState)
}

@Test
fun givenExistingConversation_ThenConversationCanBeUpdated() = runTest {
conversationDAO.insertConversation(conversationEntity1)
Expand Down Expand Up @@ -2003,6 +2015,21 @@ class ConversationDAOTest : BaseDatabaseTest() {
isMLSCapable = false
)

val mlsProtocolInfo1 = ConversationEntity.ProtocolInfo.MLS(
"group2",
ConversationEntity.GroupState.ESTABLISHED,
0UL,
Instant.parse("2021-03-30T15:36:00.000Z"),
cipherSuite = ConversationEntity.CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
)
val mlsProtocolInfo2 = ConversationEntity.ProtocolInfo.MLS(
"group3",
ConversationEntity.GroupState.PENDING_JOIN,
0UL,
Instant.parse("2021-03-30T15:36:00.000Z"),
cipherSuite = ConversationEntity.CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
)

val team = TeamEntity(teamId, "teamName", "")

val conversationEntity1 = ConversationEntity(
Expand Down Expand Up @@ -2032,13 +2059,7 @@ class ConversationDAOTest : BaseDatabaseTest() {
"conversation2",
ConversationEntity.Type.ONE_ON_ONE,
null,
ConversationEntity.ProtocolInfo.MLS(
"group2",
ConversationEntity.GroupState.ESTABLISHED,
0UL,
Instant.parse("2021-03-30T15:36:00.000Z"),
cipherSuite = ConversationEntity.CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
),
protocolInfo = mlsProtocolInfo1,
creatorId = "someValue",
lastNotificationDate = null,
lastModifiedDate = "2021-03-30T15:36:00.000Z".toInstant(),
Expand All @@ -2061,13 +2082,7 @@ class ConversationDAOTest : BaseDatabaseTest() {
"conversation3",
ConversationEntity.Type.GROUP,
null,
ConversationEntity.ProtocolInfo.MLS(
"group3",
ConversationEntity.GroupState.PENDING_JOIN,
0UL,
Instant.parse("2021-03-30T15:36:00.000Z"),
cipherSuite = ConversationEntity.CipherSuite.MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
),
protocolInfo = mlsProtocolInfo2,
creatorId = "someValue",
// This conversation was modified after the last time the user was notified about it
lastNotificationDate = "2021-03-30T15:30:00.000Z".toInstant(),
Expand Down

0 comments on commit 4466e93

Please sign in to comment.