From 7ed987b61a84a545d50971f11a05e274f43d8d6e Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Mon, 14 Oct 2024 16:16:13 +1100 Subject: [PATCH 1/2] Making sure deleted control messages leave nothing behind --- .../securesms/conversation/v2/ConversationViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt index 1dbefe7bc0b..a16695d5d26 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt @@ -312,8 +312,8 @@ class ConversationViewModel( .mapNotNull { it.slideDeck.audioSlide } .forEach(::stopMessageAudio) - // if the message was already marked as deleted, remove it from the db instead - if(messages.all { it.isDeleted }){ + // if the message was already marked as deleted or control messages, remove it from the db instead + if(messages.all { it.isDeleted || it.isControlMessage }){ // Remove the message locally (leave nothing behind) repository.deleteMessages(messages = messages, threadId = threadId) } else { From 19dfa83e4a0a06f53c66718753414293097d618b Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Mon, 14 Oct 2024 16:22:29 +1100 Subject: [PATCH 2/2] More control messages check --- .../securesms/conversation/v2/ConversationViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt index a16695d5d26..316aeec86ca 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationViewModel.kt @@ -241,7 +241,7 @@ class ConversationViewModel( // hashes are required if wanting to delete messages from the 'storage server' // They are not required for communities OR if all messages are outgoing // also we can only delete deleted messages (marked as deleted) locally - val canDeleteForEveryone = messages.all{ !it.isDeleted } && ( + val canDeleteForEveryone = messages.all{ !it.isDeleted && !it.isControlMessage } && ( messages.all { it.isOutgoing } || conversationType == MessageType.COMMUNITY || messages.all { lokiMessageDb.getMessageServerHash(it.id, it.isMms) != null