From bf0c9ec1c7f96d7643c8f8140ee6008e3c8bff97 Mon Sep 17 00:00:00 2001 From: jeffrey-signal Date: Thu, 5 Jun 2025 12:04:39 -0400 Subject: [PATCH] Fix story reactions rendering improperly after restoring a backup. --- .../backup/v2/importer/ChatItemArchiveImporter.kt | 9 ++++++--- .../securesms/conversation/v2/ConversationAdapterV2.kt | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/importer/ChatItemArchiveImporter.kt b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/importer/ChatItemArchiveImporter.kt index bd32bd99c4..2fc1dc3c2a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/importer/ChatItemArchiveImporter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/importer/ChatItemArchiveImporter.kt @@ -84,7 +84,7 @@ import java.util.UUID import org.thoughtcrime.securesms.backup.v2.proto.GiftBadge as BackupGiftBadge /** - * An object that will ingest all fo the [ChatItem]s you want to write, buffer them until hitting a specified batch size, and then batch insert them + * An object that will ingest all of the [ChatItem]s you want to write, buffer them until hitting a specified batch size, and then batch insert them * for fast throughput. */ class ChatItemArchiveImporter( @@ -519,7 +519,7 @@ class ChatItemArchiveImporter( this.paymentNotification != null -> contentValues.addPaymentNotification(this, chatRecipientId) this.giftBadge != null -> contentValues.addGiftBadge(this.giftBadge) this.viewOnceMessage != null -> contentValues.addViewOnce(this.viewOnceMessage) - this.directStoryReplyMessage != null -> contentValues.addDirectStoryReply(this.directStoryReplyMessage) + this.directStoryReplyMessage != null -> contentValues.addDirectStoryReply(this.directStoryReplyMessage, toRecipientId) } return contentValues @@ -874,8 +874,11 @@ class ChatItemArchiveImporter( put(MessageTable.VIEW_ONCE, true.toInt()) } - private fun ContentValues.addDirectStoryReply(directStoryReply: DirectStoryReplyMessage) { + private fun ContentValues.addDirectStoryReply(directStoryReply: DirectStoryReplyMessage, toRecipientId: RecipientId) { put(MessageTable.PARENT_STORY_ID, MessageTable.PARENT_STORY_MISSING_ID) + put(MessageTable.QUOTE_MISSING, 1) + put(MessageTable.QUOTE_ID, MessageTable.QUOTE_TARGET_MISSING_ID) + put(MessageTable.QUOTE_AUTHOR, toRecipientId.serialize()) if (directStoryReply.emoji != null) { put(MessageTable.BODY, directStoryReply.emoji) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt index 6246968df8..bb59abc679 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapterV2.kt @@ -80,7 +80,7 @@ class ConversationAdapterV2( companion object { private val TAG = Log.tag(ConversationAdapterV2::class.java) - private val MIN_GROUPS_THRESHOLD = 2 + private const val MIN_GROUPS_THRESHOLD = 2 } private val _selected = hashSetOf()