BugFix for when the private room is with yourself.

pull/549/head
Vitor Pamplona 2023-08-11 19:47:17 -04:00
rodzic b4d87686ac
commit f97a0468cc
1 zmienionych plików z 9 dodań i 7 usunięć

Wyświetl plik

@ -29,16 +29,18 @@ class ChatMessageEvent(
fun talkingWith(oneSideHex: String): Set<HexKey> {
val listedPubKeys = recipientsPubKey()
return if (pubKey == oneSideHex) {
if (listedPubKeys.isEmpty()) {
// talking to myself
return setOf(pubKey)
} else {
listedPubKeys.minus(oneSideHex).toSet()
}
val result = if (pubKey == oneSideHex) {
listedPubKeys.minus(oneSideHex).toSet()
} else {
listedPubKeys.plus(pubKey).minus(oneSideHex).toSet()
}
if (result.isEmpty()) {
// talking to myself
return setOf(pubKey)
}
return result
}
override fun chatroomKey(toRemove: String): ChatroomKey {