Prevent FK violation from bad decryption insert.

Fixes #12880
This commit is contained in:
Greyson Parrelli
2023-04-10 13:33:28 -04:00
parent ca0dd03042
commit c5af204de3
3 changed files with 21 additions and 2 deletions

View File

@@ -1684,6 +1684,13 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
return updated
}
fun containsId(id: RecipientId): Boolean {
return readableDatabase
.exists(TABLE_NAME)
.where("$ID = ?", id.serialize())
.run()
}
fun setReportingToken(id: RecipientId, reportingToken: ByteArray) {
val values = ContentValues(1).apply {
put(REPORTING_TOKEN, reportingToken)

View File

@@ -637,6 +637,13 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
}
}
fun containsId(threadId: Long): Boolean {
return readableDatabase
.exists(TABLE_NAME)
.where("$ID = ?", threadId)
.run()
}
fun getFilteredConversationList(filter: List<RecipientId>, unreadOnly: Boolean): Cursor? {
if (filter.isEmpty()) {
return null