Skip to content

Commit

Permalink
fix(migration): select proteus conversationId for mls migration in al…
Browse files Browse the repository at this point in the history
…phabetically order (#2962) (#2964) (#2996)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mojtaba Chenani <[email protected]>
Co-authored-by: Boris Safonov <[email protected]>
Co-authored-by: Mohamad Jaara <[email protected]>
  • Loading branch information
4 people authored Sep 13, 2024
1 parent 7f991e6 commit 7339061
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ WHERE qualified_id = (SELECT active_one_on_one_conversation_id FROM User WHERE q
selectOneOnOneConversationIdsByProtocol:
SELECT Member.conversation FROM Member
JOIN Conversation ON Conversation.qualified_id = Member.conversation
WHERE Conversation.type = 'ONE_ON_ONE' AND Conversation.protocol = :protocol AND Member.user = :user;
WHERE Conversation.type = 'ONE_ON_ONE' AND Conversation.protocol = :protocol AND Member.user = :user
ORDER BY Member.conversation ASC;

getConversationIdByGroupId:
SELECT qualified_id FROM Conversation WHERE mls_group_id = ?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,26 @@ class ConversationDAOTest : BaseDatabaseTest() {
)
}

@Test
fun givenMultipleOneOnOneProteusConversationExisting_whenGettingOneOnOneConversationId_thenShouldReturnAlphabeticallyOrderedConversation() =
runTest {
// given
val conversationA = conversationEntity1.copy(id = QualifiedIDEntity("a", "wire.com"))
val conversationB = conversationEntity1.copy(id = QualifiedIDEntity("b", "wire.com"))

userDAO.upsertUser(user1)
conversationDAO.insertConversation(conversationB)
conversationDAO.insertConversation(conversationA)
memberDAO.insertMember(member1, conversationB.id)
memberDAO.insertMember(member1, conversationA.id)

// then
assertEquals(
conversationA.id,
conversationDAO.getOneOnOneConversationIdsWithOtherUser(user1.id, protocol = ConversationEntity.Protocol.PROTEUS).first()
)
}

@Test
fun givenNoMLSConversationExistsForGivenClients_whenGettingE2EIClientInfoByClientId_thenReturnsNull() = runTest {
// given
Expand Down

0 comments on commit 7339061

Please sign in to comment.