From c4250688653f30642eeefbcb4afba92abfa4bc6e Mon Sep 17 00:00:00 2001 From: Alexandre Ferris Date: Mon, 11 Mar 2024 21:51:26 +0100 Subject: [PATCH 1/2] fix: Missing MLS Conversation (WPB-7085) (#2617) * fix: invert order for fetching conversation if unknown * fix: tests --- .../sync/receiver/conversation/MLSWelcomeEventHandler.kt | 8 ++++---- .../receiver/conversation/MLSWelcomeEventHandlerTest.kt | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandler.kt b/logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandler.kt index 084c6b09d83..5af954af042 100644 --- a/logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandler.kt +++ b/logic/src/commonMain/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandler.kt @@ -56,14 +56,14 @@ internal class MLSWelcomeEventHandlerImpl( private val certificateRevocationListRepository: CertificateRevocationListRepository ) : MLSWelcomeEventHandler { override suspend fun handle(event: Event.Conversation.MLSWelcome): Either = - mlsClientProvider - .getMLSClient() + conversationRepository.fetchConversationIfUnknown(event.conversationId) + .flatMap { + mlsClientProvider.getMLSClient() + } .flatMap { client -> wrapMLSRequest { client.processWelcomeMessage(event.message.decodeBase64Bytes()) } - }.flatMap { groupID -> - conversationRepository.fetchConversationIfUnknown(event.conversationId).map { groupID } }.flatMap { welcomeBundle -> welcomeBundle.crlNewDistributionPoints?.let { checkRevocationList(it) diff --git a/logic/src/commonTest/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandlerTest.kt b/logic/src/commonTest/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandlerTest.kt index c1f46fb97ea..18f8ddf4640 100644 --- a/logic/src/commonTest/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandlerTest.kt +++ b/logic/src/commonTest/kotlin/com/wire/kalium/logic/sync/receiver/conversation/MLSWelcomeEventHandlerTest.kt @@ -62,6 +62,7 @@ class MLSWelcomeEventHandlerTest { val exception = RuntimeException() val (arrangement, mlsWelcomeEventHandler) = arrange { + withFetchConversationIfUnknownSucceeding() withMLSClientProcessingOfWelcomeMessageFailsWith(exception) } From 3e0e71fafa2dac9809a89bf4e9f14d0a4a1c02e7 Mon Sep 17 00:00:00 2001 From: alexandreferris Date: Tue, 12 Mar 2024 09:53:20 +0100 Subject: [PATCH 2/2] empty trigger commit