SES-2819 - Do not show a reaction on a deleted message

This commit is contained in:
ThomasSession 2024-10-17 10:29:06 +11:00
parent cf344b7180
commit 711e31a43a

View File

@ -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(