diff --git a/apps/ios/Shared/Views/Chat/Group/ChannelRelaysView.swift b/apps/ios/Shared/Views/Chat/Group/ChannelRelaysView.swift index 7b3935e4b2..dbcc79972a 100644 --- a/apps/ios/Shared/Views/Chat/Group/ChannelRelaysView.swift +++ b/apps/ios/Shared/Views/Chat/Group/ChannelRelaysView.swift @@ -110,7 +110,10 @@ struct ChannelRelaysView: View { } private func ownerRelayStatusText(_ member: GroupMember) -> LocalizedStringKey { - if [.memLeft, .memRemoved, .memGroupDeleted].contains(member.memberStatus) { + let relayStatus = groupRelays.first(where: { $0.groupMemberId == member.groupMemberId })?.relayStatus + return if relayStatus == .rsRejected { + "rejected" + } else if [.memLeft, .memRemoved, .memGroupDeleted].contains(member.memberStatus) { relayConnStatus(member).text } else if case .failed = member.activeConn?.connStatus { "failed" @@ -119,8 +122,7 @@ struct ChannelRelaysView: View { } else if member.activeConn?.connInactive ?? false { "inactive" } else { - groupRelays.first(where: { $0.groupMemberId == member.groupMemberId })?.relayStatus.text - ?? relayConnStatus(member).text + relayStatus?.text ?? relayConnStatus(member).text } } diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelRelaysView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelRelaysView.kt index d6150a1d08..8b1036ccd7 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelRelaysView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelRelaysView.kt @@ -175,7 +175,10 @@ private fun subscriberRelayStatusText(member: GroupMember): String { } private fun ownerRelayStatusText(member: GroupMember, groupRelays: List): String { - return if (member.memberStatus in listOf(GroupMemberStatus.MemLeft, GroupMemberStatus.MemRemoved, GroupMemberStatus.MemGroupDeleted)) { + val relayStatus = groupRelays.firstOrNull { it.groupMemberId == member.groupMemberId }?.relayStatus + return if (relayStatus == RelayStatus.RsRejected) { + generalGetString(MR.strings.relay_status_rejected) + } else if (member.memberStatus in listOf(GroupMemberStatus.MemLeft, GroupMemberStatus.MemRemoved, GroupMemberStatus.MemGroupDeleted)) { relayConnStatus(member).first } else if (member.activeConn?.connStatus is ConnStatus.Failed) { generalGetString(MR.strings.relay_conn_status_failed) @@ -184,8 +187,7 @@ private fun ownerRelayStatusText(member: GroupMember, groupRelays: List case members of [m] -> ttyUser u [ttyGroup' g <> ": you removed " <> ttyMember m <> " from the group" <> withMessages wm <> signedStr signed] mems' -> ttyUser u [ttyGroup' g <> ": you removed " <> sShow (length mems') <> " members from the group" <> withMessages wm <> signedStr signed] - CRLeftMemberUser u g -> ttyUser u $ [ttyGroup' g <> ": you left the group"] <> groupPreserved g + CRLeftMemberUser u g + | relayOwnStatus g == Just RSRejected -> + ttyUser u + [ ttyGroup' g <> ": you left the group (future invitations will be rejected)", + "use " <> highlight ("/relay allow #" <> viewGroupName g) <> " then " <> highlight ("/d #" <> viewGroupName g) <> " to delete the group" + ] + | otherwise -> ttyUser u $ [ttyGroup' g <> ": you left the group"] <> groupPreserved g CRGroupDeletedUser u g signed -> ttyUser u [ttyGroup' g <> ": you deleted the group" <> signedStr signed] CRForwardPlan u count itemIds fc -> ttyUser u $ viewForwardPlan count itemIds fc CRChatMsgContent u mc -> ttyUser u $ ttyMsgContent mc <> viewMsgTestInfo testView mc diff --git a/tests/ChatTests/Groups.hs b/tests/ChatTests/Groups.hs index 137679ded6..861dc1414f 100644 --- a/tests/ChatTests/Groups.hs +++ b/tests/ChatTests/Groups.hs @@ -9969,8 +9969,8 @@ testRelayRejectAfterLeave ps = -- relay leaves the channel: subscriber gets the signed leave notice via bob's -- DJRelayRemoved job, then has no relay to forward subsequent messages. bob ##> "/leave #team" - bob <## "#team: you left the group" - bob <## "use /d #team to delete the group" + bob <## "#team: you left the group (future invitations will be rejected)" + bob <## "use /relay allow #team then /d #team to delete the group" concurrentlyN_ [ alice <## "#team: bob left the group (signed)", cath <## "#team: bob left the group (signed)" @@ -10034,8 +10034,8 @@ testRelayAllowAcceptsAgain ps = cath <# "#team> hello [>>]" bob ##> "/leave #team" - bob <## "#team: you left the group" - bob <## "use /d #team to delete the group" + bob <## "#team: you left the group (future invitations will be rejected)" + bob <## "use /relay allow #team then /d #team to delete the group" concurrentlyN_ [ alice <## "#team: bob left the group (signed)", cath <## "#team: bob left the group (signed)" @@ -10104,8 +10104,8 @@ testRelayDoesNotRejectUnrelatedChannel ps = threadDelay 100000 bob ##> "/leave #teama" - bob <## "#teama: you left the group" - bob <## "use /d #teama to delete the group" + bob <## "#teama: you left the group (future invitations will be rejected)" + bob <## "use /relay allow #teama then /d #teama to delete the group" alice <## "#teama: bob left the group (signed)" threadDelay 100000 @@ -10146,8 +10146,8 @@ testRelayRejectRaceConcurrentInvitations ps = cath <# "#team> hello [>>]" bob ##> "/leave #team" - bob <## "#team: you left the group" - bob <## "use /d #team to delete the group" + bob <## "#team: you left the group (future invitations will be rejected)" + bob <## "use /relay allow #team then /d #team to delete the group" concurrentlyN_ [ alice <## "#team: bob left the group (signed)", cath <## "#team: bob left the group (signed)" @@ -10202,8 +10202,8 @@ testRelayDeleteRejectedBlocked ps = cath <# "#team> hello [>>]" bob ##> "/leave #team" - bob <## "#team: you left the group" - bob <## "use /d #team to delete the group" + bob <## "#team: you left the group (future invitations will be rejected)" + bob <## "use /relay allow #team then /d #team to delete the group" concurrentlyN_ [ alice <## "#team: bob left the group (signed)", cath <## "#team: bob left the group (signed)"