This commit is contained in:
spaced4ndy
2026-05-16 00:09:29 +04:00
parent 6fe2bf74fd
commit 2d1d0f5bf1
4 changed files with 27 additions and 17 deletions
@@ -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
}
}
@@ -175,7 +175,10 @@ private fun subscriberRelayStatusText(member: GroupMember): String {
}
private fun ownerRelayStatusText(member: GroupMember, groupRelays: List<GroupRelay>): 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<GroupRel
} else if (member.activeConn?.connInactive == true) {
generalGetString(MR.strings.member_info_member_inactive)
} else {
groupRelays.firstOrNull { it.groupMemberId == member.groupMemberId }?.relayStatus?.text
?: relayConnStatus(member).first
relayStatus?.text ?: relayConnStatus(member).first
}
}
+7 -1
View File
@@ -223,7 +223,13 @@ chatResponseToView hu cfg@ChatConfig {logLevel, showReactions, testView} liveIte
CRUserDeletedMembers u g members wm signed -> 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
+10 -10
View File
@@ -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)"