prevent delete all members

This commit is contained in:
2026-05-31 17:05:56 +07:00
parent a3ab489d44
commit badc47bb61

View File

@@ -43,8 +43,11 @@ data class Room(
val pubkeys: MutableSet<PublicKey> = mutableSetOf() val pubkeys: MutableSet<PublicKey> = mutableSetOf()
pubkeys.add(rumor.author()) pubkeys.add(rumor.author())
pubkeys.addAll(rumor.tags().publicKeys()) pubkeys.addAll(rumor.tags().publicKeys())
// Also remove the user's public key from the list, current user is always a member // Also remove the user's public key from the list, current user is always a member
if (pubkeys.size > 1 && pubkeys.contains(userPubkey)) {
pubkeys.remove(userPubkey) pubkeys.remove(userPubkey)
}
// Create a new Room instance // Create a new Room instance
return Room( return Room(