increasing counter when new report arrives

This commit is contained in:
Avently
2025-01-10 17:01:05 +07:00
parent 6dd6608e94
commit 97e21e68b6
2 changed files with 16 additions and 1 deletions

View File

@@ -799,8 +799,19 @@ object ChatModel {
changeUnreadCounterNoContentTag(rhId, user, -by)
}
fun increaseGroupReportsCounter(rhId: Long?, chatId: ChatId) {
val i = getChatIndex(rhId, chatId)
if (i >= 0) {
val chat = chats.value[i]
chats[i] = chat.copy(
chatStats = chat.chatStats.copy(
reportsCount = chat.chatStats.reportsCount + 1
)
)
}
}
fun decreaseGroupReportsCounter(rhId: Long?, chatId: ChatId, wasArchived: Boolean) {
return
val i = getChatIndex(rhId, chatId)
if (i >= 0) {
val chat = chats.value[i]

View File

@@ -2479,6 +2479,10 @@ object ChatController {
if (active(r.user)) {
withChats {
addChatItem(rhId, cInfo, cItem)
val isActiveReport = cItem.isReport && !cItem.isDeletedContent && cItem.meta.itemDeleted == null
if (isActiveReport) {
increaseGroupReportsCounter(rhId, cInfo.id)
}
}
withReportsChatsIfOpen {
if (cItem.isReport) {