From f0412a3d7421d42594849c4c71c5eac05baaf8b0 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Wed, 8 Jul 2026 16:43:17 +0200 Subject: [PATCH] Bug fix on sending welcomingEvent to self --- .../kotlin/at/torch/compose/database/dao/MarmotOutboundDao.kt | 1 + .../compose/database/repository/DatabaseChatRepository.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/at/torch/compose/database/dao/MarmotOutboundDao.kt b/composeApp/src/commonMain/kotlin/at/torch/compose/database/dao/MarmotOutboundDao.kt index dfb4e1b5..f9625cc1 100644 --- a/composeApp/src/commonMain/kotlin/at/torch/compose/database/dao/MarmotOutboundDao.kt +++ b/composeApp/src/commonMain/kotlin/at/torch/compose/database/dao/MarmotOutboundDao.kt @@ -129,6 +129,7 @@ abstract class MarmotOutboundDao( relays: List = Relays.DefaultDMRelayList.map { it.url }, isOneMemberInitialGroupCreation: Boolean ) { + logger.d("inviteMember: $peerPublicKey") val keyPackage = MlsKeyPackage.decodeTls( TlsReader( peerKeyPackage.tlsEncodedMarmotKeyPackage diff --git a/composeApp/src/commonMain/kotlin/at/torch/compose/database/repository/DatabaseChatRepository.kt b/composeApp/src/commonMain/kotlin/at/torch/compose/database/repository/DatabaseChatRepository.kt index 378a609e..d5c60280 100644 --- a/composeApp/src/commonMain/kotlin/at/torch/compose/database/repository/DatabaseChatRepository.kt +++ b/composeApp/src/commonMain/kotlin/at/torch/compose/database/repository/DatabaseChatRepository.kt @@ -245,8 +245,8 @@ class DatabaseChatRepository( nostrSignerSync: NostrSignerSync ) { database.participantDao().findParticipantsByChatRoomId(giftWrapPayload.chatRoomId).forEachIndexed { index, participant -> - if (giftWrapPayload.kind == WelcomeEvent.KIND && giftWrapPayload.publicKey != participant.participantPublicKey) { - logger.w("We shouldn't be gift wrapping welcome event to anyone but the intended public key (${giftWrapPayload.id}).") + if (giftWrapPayload.kind == WelcomeEvent.KIND && nostrSignerSync.pubKey == participant.participantPublicKey) { + logger.w("We shouldn't be gift wrapping welcome event to ourselves (${nostrSignerSync.pubKey}).") } else { val wrapperKeyPair = KeyPair() val wrapperSigner = NostrSignerSync(