Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making sure deleted control messages leave nothing behind #1693

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down