ui: update member support chats list from delete responses

This commit is contained in:
Narasimha-sc
2026-09-27 21:21:18 +00:00
parent 74399a833e
commit 67422bbbc3
3 changed files with 7 additions and 1 deletions
@@ -2836,6 +2836,7 @@ struct ChatView: View {
m.decreaseGroupReportsCounter(chat.chatInfo.id)
}
m.updateChatInfo(itemDeletion.deletedChatItem.chatInfo)
m.upsertSupportChatMember(itemDeletion.deletedChatItem.chatInfo)
}
}
}
@@ -3040,6 +3041,7 @@ private func deleteMessages(_ chat: Chat, _ deletingItems: [Int64], _ mode: CIDe
}
if let updatedChatInfo = deletedItems.last?.deletedChatItem.chatInfo {
ChatModel.shared.updateChatInfo(updatedChatInfo)
ChatModel.shared.upsertSupportChatMember(updatedChatInfo)
}
}
await onSuccess()
@@ -3078,6 +3080,7 @@ func archiveReports(_ chat: Chat, _ itemIds: [Int64], _ forAll: Bool, _ onSucces
}
if let updatedChatInfo = deleted.last?.deletedChatItem.chatInfo {
ChatModel.shared.updateChatInfo(updatedChatInfo)
ChatModel.shared.upsertSupportChatMember(updatedChatInfo)
}
}
await onSuccess()
@@ -573,6 +573,7 @@ fun ChatView(
chatModel.chatsContext.decreaseGroupReportsCounter(chatRh, chatInfo.id)
}
chatModel.chatsContext.updateChatInfo(chatRh, deleted.deletedChatItem.chatInfo)
chatModel.upsertSupportChatMember(chatRh, deleted.deletedChatItem.chatInfo)
}
withContext(Dispatchers.Main) {
if (toChatItem != null) {
@@ -3404,6 +3405,7 @@ private fun deleteMessages(chatRh: Long?, chatInfo: ChatInfo, itemIds: List<Long
}
deleted.lastOrNull()?.deletedChatItem?.chatInfo?.let { updatedChatInfo ->
chatModel.chatsContext.updateChatInfo(chatRh, updatedChatInfo)
chatModel.upsertSupportChatMember(chatRh, updatedChatInfo)
}
}
withContext(Dispatchers.Main) {
@@ -3441,6 +3443,7 @@ private fun archiveReports(chatRh: Long?, chatInfo: ChatInfo, itemIds: List<Long
}
deleted.lastOrNull()?.deletedChatItem?.chatInfo?.let { updatedChatInfo ->
chatModel.chatsContext.updateChatInfo(chatRh, updatedChatInfo)
chatModel.upsertSupportChatMember(chatRh, updatedChatInfo)
}
}
withContext(Dispatchers.Main) {
+1 -1
View File
@@ -39,6 +39,7 @@ Load the list once per open group, then keep it current from what arrives.
- It is called for:
- `NewChatItems` events;
- `ChatItemsDeleted` events;
- delete responses (items and reports);
- send responses (Kotlin only);
- the mark-read response;
- the initial load of a support chat.
@@ -51,7 +52,6 @@ A member's first support message arrives as a `NewChatItems` event with that mem
## Not covered
- On iOS, `apiSendMessages` returns bare `ChatItem`s without chat info. The list's last-activity order after the user's own reply updates only when the group is reopened.
- API-response deletions made by the user themselves are not hooked. Only deletion events are. Items the user deletes are normally already read.
## Alternatives considered