mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 17:27:57 +00:00
refactor
This commit is contained in:
@@ -2392,6 +2392,8 @@ data class ChatItem (
|
||||
else -> false
|
||||
}
|
||||
|
||||
val isActiveReport: Boolean get() = isReport && !isDeletedContent && meta.itemDeleted == null
|
||||
|
||||
val canBeDeletedForSelf: Boolean
|
||||
get() = (content.msgContent != null && !meta.isLive) || meta.itemDeleted != null || isDeletedContent || mergeCategory != null || showLocalDelete
|
||||
|
||||
|
||||
@@ -2479,8 +2479,7 @@ object ChatController {
|
||||
if (active(r.user)) {
|
||||
withChats {
|
||||
addChatItem(rhId, cInfo, cItem)
|
||||
val isActiveReport = cItem.isReport && !cItem.isDeletedContent && cItem.meta.itemDeleted == null
|
||||
if (isActiveReport) {
|
||||
if (cItem.isActiveReport) {
|
||||
increaseGroupReportsCounter(rhId, cInfo.id)
|
||||
}
|
||||
}
|
||||
@@ -2614,8 +2613,7 @@ object ChatController {
|
||||
CIDeleted.Deleted(Clock.System.now())
|
||||
}
|
||||
upsertChatItem(rhId, cInfo, cItem.copy(meta = cItem.meta.copy(itemDeleted = deleted)))
|
||||
val isActiveReport = cItem.isReport && !cItem.isDeletedContent && cItem.meta.itemDeleted == null
|
||||
if (isActiveReport) {
|
||||
if (cItem.isActiveReport) {
|
||||
decreaseGroupReportsCounter(rhId, cInfo.id, wasModerated)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,8 +398,7 @@ fun ChatView(
|
||||
removeChatItem(chatRh, chatInfo, deletedChatItem)
|
||||
}
|
||||
val deletedItem = deleted.deletedChatItem.chatItem
|
||||
val isActiveReport = deletedItem.isReport == true && !deletedItem.isDeletedContent && deletedItem.meta.itemDeleted == null
|
||||
if (isActiveReport) {
|
||||
if (deletedItem.isActiveReport) {
|
||||
decreaseGroupReportsCounter(chatRh, chatInfo.id, toChatItem != null)
|
||||
}
|
||||
}
|
||||
@@ -2334,8 +2333,7 @@ private fun deleteMessages(chatRh: Long?, chatInfo: ChatInfo, itemIds: List<Long
|
||||
removeChatItem(chatRh, chatInfo, di.deletedChatItem.chatItem)
|
||||
}
|
||||
val deletedItem = di.deletedChatItem.chatItem
|
||||
val isActiveReport = deletedItem.isReport && !deletedItem.isDeletedContent && deletedItem.meta.itemDeleted == null
|
||||
if (isActiveReport) {
|
||||
if (deletedItem.isActiveReport) {
|
||||
decreaseGroupReportsCounter(chatRh, chatInfo.id, toChatItem != null)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user