Fix issue where delivery receipts may not update the thread summary.

We were notifying in a transaction, which we can't do anymore since
transactions don't block reads from other threads (meaning we could
notify and someone could read it before we end the transaction, so they
wouldn't see the update).
This commit is contained in:
Greyson Parrelli
2021-10-26 09:10:56 -04:00
parent dd7652ad44
commit ba0befde20
2 changed files with 6 additions and 2 deletions
@@ -469,7 +469,7 @@ public class MmsSmsDatabase extends Database {
}
for (ThreadUpdate update : threadUpdates) {
threadDatabase.update(update.getThreadId(), false);
threadDatabase.updateSilently(update.getThreadId(), false);
}
db.setTransactionSuccessful();
@@ -483,6 +483,10 @@ public class MmsSmsDatabase extends Database {
notifyConversationListeners(threadUpdate.getThreadId());
}
}
if (threadUpdates.size() > 0) {
notifyConversationListListeners();
}
}
return unhandled;
@@ -521,7 +521,7 @@ public class SmsDatabase extends MessageDatabase {
}
}
if (threadUpdates.size() > 0 && receiptType == ReceiptType.DELIVERY) {
if (threadUpdates.isEmpty() && receiptType == ReceiptType.DELIVERY) {
earlyDeliveryReceiptCache.increment(messageId.getTimetamp(), messageId.getRecipientId(), timestamp);
}