From 260bd676cc0748981a202ff5984d7e82e13c90f2 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Mon, 20 Apr 2026 10:58:59 +0000 Subject: [PATCH] ui: fix channel creation with relays of disabled operator (#6841) --- apps/ios/Shared/Views/NewChat/AddChannelView.swift | 2 ++ .../kotlin/chat/simplex/common/views/newchat/AddChannelView.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/ios/Shared/Views/NewChat/AddChannelView.swift b/apps/ios/Shared/Views/NewChat/AddChannelView.swift index 3951d8261e..4e9a42971c 100644 --- a/apps/ios/Shared/Views/NewChat/AddChannelView.swift +++ b/apps/ios/Shared/Views/NewChat/AddChannelView.swift @@ -222,6 +222,7 @@ struct AddChannelView: View { var operatorGroups: [[UserChatRelay]] = [] var customRelays: [UserChatRelay] = [] for op in servers { + guard op.operator?.enabled ?? true else { continue } let relays = op.chatRelays.filter { $0.enabled && !$0.deleted && $0.chatRelayId != nil } guard !relays.isEmpty else { continue } if op.operator != nil { @@ -256,6 +257,7 @@ struct AddChannelView: View { private func checkHasRelays() async -> Bool { guard let servers = try? await getUserServers() else { return false } return servers.contains { op in + (op.operator?.enabled ?? true) && op.chatRelays.contains { $0.enabled && !$0.deleted && $0.chatRelayId != nil } } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt index f0bba5c4ec..e60fcfc921 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/newchat/AddChannelView.kt @@ -180,6 +180,7 @@ private suspend fun chooseRandomRelays(): List { val operatorGroups = mutableListOf>() var customRelays = mutableListOf() for (op in servers) { + if (op.operator?.enabled == false) continue val relays = op.chatRelays.filter { it.enabled && !it.deleted && it.chatRelayId != null } if (relays.isEmpty()) continue if (op.operator != null) { @@ -212,6 +213,7 @@ private suspend fun chooseRandomRelays(): List { private suspend fun checkHasRelays(): Boolean { val servers = try { getUserServers(rh = null) } catch (_: Exception) { null } ?: return false return servers.any { op -> + (op.operator?.enabled ?: true) && op.chatRelays.any { it.enabled && !it.deleted && it.chatRelayId != null } } }