From badc47bb61ff8021ca86b466c6fe69efb7cf4d01 Mon Sep 17 00:00:00 2001 From: Ren Amamiya Date: Sun, 31 May 2026 17:05:56 +0700 Subject: [PATCH] prevent delete all members --- shared/src/commonMain/kotlin/su/reya/coop/Room.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(