Fix thread update with drafts bugs.

* Fix thread not updating correctly when drafts are present.
* Fix thread delete bug during first message drafting.
This commit is contained in:
Cody Henthorne
2022-11-17 11:26:29 -05:00
parent 9ee10512fb
commit dfb913cb98
3 changed files with 13 additions and 2 deletions

View File

@@ -1327,6 +1327,17 @@ class ThreadDatabase(context: Context, databaseHelper: SignalDatabase) : Databas
return true
}
val drafts: DraftDatabase.Drafts = SignalDatabase.drafts.getDrafts(threadId)
if (drafts.isNotEmpty()) {
val threadRecord: ThreadRecord? = getThreadRecord(threadId)
if (threadRecord != null &&
threadRecord.type == MmsSmsColumns.Types.BASE_DRAFT_TYPE &&
threadRecord.date > record.timestamp
) {
return false
}
}
updateThread(
threadId = threadId,
meaningfulMessages = meaningfulMessages,