Фикс: откат агрессивной проверки в updateMessageStatusInDb — ломала все статусы
All checks were successful
Android Kernel Build / build (push) Successful in 19m55s
All checks were successful
Android Kernel Build / build (push) Successful in 19m55s
Оставлена защита только в updateMessageStatusAndAttachmentsInDb (для фото race condition). findMessageById обёрнут в отдельный try/catch чтобы ошибка в нём не блокировала основной update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -724,9 +724,6 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private suspend fun updateMessageStatusInDb(messageId: String, delivered: Int) {
|
||||
val account = myPublicKey ?: return
|
||||
try {
|
||||
// Never downgrade delivery status
|
||||
val existing = messageDao.findMessageById(account, messageId)
|
||||
if (existing != null && existing.delivered > delivered) return
|
||||
messageDao.updateDeliveryStatus(account, messageId, delivered)
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
@@ -740,8 +737,11 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
||||
val account = myPublicKey ?: return
|
||||
try {
|
||||
// Never downgrade delivery status (e.g. DELIVERED→WAITING race)
|
||||
val existing = messageDao.findMessageById(account, messageId)
|
||||
val safeDelivered = if (existing != null && existing.delivered > delivered) existing.delivered else delivered
|
||||
val safeDelivered = try {
|
||||
val existing = messageDao.findMessageById(account, messageId)
|
||||
if (existing != null && existing.delivered > delivered) existing.delivered else delivered
|
||||
} catch (_: Exception) { delivered }
|
||||
|
||||
messageDao.updateDeliveryStatusAndAttachments(
|
||||
account,
|
||||
messageId,
|
||||
|
||||
Reference in New Issue
Block a user