Fix story linking from private story reply.

This commit is contained in:
clark-signal
2023-01-12 16:23:53 -05:00
committed by Cody Henthorne
parent c3c8f8e7e6
commit 7af94f60ae
2 changed files with 28 additions and 1 deletions

View File

@@ -191,6 +191,24 @@ class StorySendTable(context: Context, databaseHelper: SignalDatabase) : Databas
return messageIds
}
fun getStoryMessageFor(recipientId: RecipientId, timestamp: Long): MessageId? {
readableDatabase.query(
TABLE_NAME,
arrayOf(MESSAGE_ID),
"$RECIPIENT_ID = ? AND $SENT_TIMESTAMP = ?",
SqlUtil.buildArgs(recipientId, timestamp),
null,
null,
null,
"1"
).use { cursor ->
if (cursor.moveToFirst()) {
return MessageId(cursor.requireLong(MESSAGE_ID))
}
}
return null
}
override fun remapRecipient(oldId: RecipientId, newId: RecipientId) {
val query = "$RECIPIENT_ID = ?"
val args = SqlUtil.buildArgs(oldId)