From b7c5b64022b128b13271cd6f19cf279ba4a7d5f7 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Mon, 1 Jun 2026 02:53:56 +0000 Subject: [PATCH] fix: no member in room (#8) Reviewed-on: https://git.reya.su/reya/coop-mobile/pulls/8 --- shared/src/commonMain/kotlin/su/reya/coop/Nostr.kt | 2 +- shared/src/commonMain/kotlin/su/reya/coop/Room.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/su/reya/coop/Nostr.kt b/shared/src/commonMain/kotlin/su/reya/coop/Nostr.kt index c56555c..e098895 100644 --- a/shared/src/commonMain/kotlin/su/reya/coop/Nostr.kt +++ b/shared/src/commonMain/kotlin/su/reya/coop/Nostr.kt @@ -596,7 +596,7 @@ class Nostr { val kTag = SingleLetterTag.lowercase(Alphabet.K) // Get all events sent by the user - val filter = Filter().kind(kind).author(userPubkey).customTag(kTag, "dm") + val filter = Filter().kind(kind).author(userPubkey).customTag(kTag, "14") val events = client?.database()?.query(filter) // Collect rooms diff --git a/shared/src/commonMain/kotlin/su/reya/coop/Room.kt b/shared/src/commonMain/kotlin/su/reya/coop/Room.kt index 373f787..b8672b8 100644 --- a/shared/src/commonMain/kotlin/su/reya/coop/Room.kt +++ b/shared/src/commonMain/kotlin/su/reya/coop/Room.kt @@ -43,8 +43,11 @@ data class Room( val pubkeys: MutableSet = mutableSetOf() pubkeys.add(rumor.author()) pubkeys.addAll(rumor.tags().publicKeys()) + // Also remove the user's public key from the list, current user is always a member - pubkeys.remove(userPubkey) + if (pubkeys.size > 1 && pubkeys.contains(userPubkey)) { + pubkeys.remove(userPubkey) + } // Create a new Room instance return Room(