android, desktop: keep sent support message in main chat preview for pending invitee

A message sent in a secondary scope (member support / "chat with admins") is
added only to the active context (ComposeView passes its own chatsCtx), unlike
received items which the NewChatItems handler delivers to both the primary and
secondary contexts. After the index-correct revert of #5909's chatsContext.chats[i]
write, a pending invitee's sent support message no longer appeared in the main
chat list preview.

Mirror the receive path: when adding a sent item on a secondary context, also
update the primary context, so the main chat list preview updates at the correct
index. Sent items are not RcvNew, so this adds no unread double-count.
This commit is contained in:
Narasimha-sc
2026-06-18 10:07:43 +00:00
parent 6cea118fc3
commit 862d93c647
@@ -520,6 +520,11 @@ object ChatModel {
}
suspend fun addChatItem(rhId: Long?, chatInfo: ChatInfo, cItem: ChatItem) {
// Sent items reach only the active context; received items reach both. Mirror that so a message
// sent in a secondary scope (member support) still updates the main chat list preview (#5909).
if (secondaryContextFilter != null && cItem.chatDir.sent) {
chatsContext.addChatItem(rhId, chatInfo, cItem)
}
// updates membersRequireAttention
val cInfo = if (chatInfo is ChatInfo.Direct && chatInfo.chatDeleted) {
// mark chat non deleted