From 711e31a43a889187ec3be189ad4aa78f18c217d7 Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Thu, 17 Oct 2024 10:29:06 +1100 Subject: [PATCH] SES-2819 - Do not show a reaction on a deleted message --- .../java/org/thoughtcrime/securesms/database/Storage.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index a1903cc891..67f68cb292 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -1686,12 +1686,17 @@ open class Storage( val timestamp = reaction.timestamp val localId = reaction.localId val isMms = reaction.isMms + val messageRecord = timestamp?.let{ DatabaseComponent.get(context).mmsSmsDatabase().getMessageForTimestamp(timestamp) } + + // leave if this is about a deleted messsage + if (messageRecord?.isDeleted == true) return + val messageId = if (localId != null && localId > 0 && isMms != null) { MessageId(localId, isMms) - } else if (timestamp != null && timestamp > 0) { - val messageRecord = DatabaseComponent.get(context).mmsSmsDatabase().getMessageForTimestamp(timestamp) ?: return + } else if (messageRecord != null && timestamp > 0) { MessageId(messageRecord.id, messageRecord.isMms) } else return + DatabaseComponent.get(context).reactionDatabase().addReaction( messageId, ReactionRecord(