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) }