git » sdk » commit 0de12f5

Don't pull in corrections as unreads

author Stephen Paul Weber
2025-03-24 02:56:04 UTC
committer Stephen Paul Weber
2025-03-24 02:56:04 UTC
parent cc8cd261775f3766386126b94c2c170a7ab8c348

Don't pull in corrections as unreads

snikket/persistence/Sqlite.hx +1 -1

diff --git a/snikket/persistence/Sqlite.hx b/snikket/persistence/Sqlite.hx
index 806257a..e50059b 100644
--- a/snikket/persistence/Sqlite.hx
+++ b/snikket/persistence/Sqlite.hx
@@ -450,7 +450,7 @@ class Sqlite implements Persistence implements KeyValueStore {
 		final q = new StringBuf();
 		q.add("SELECT chat_id AS chatId, stanza, direction, type, sender_id, mam_id, mam_by, sync_point, CASE WHEN subq.created_at IS NULL THEN COUNT(*) ELSE COUNT(*) - 1 END AS unreadCount, strftime('%FT%H:%M:%fZ', MAX(messages.created_at) / 1000.0, 'unixepoch') AS timestamp FROM messages LEFT JOIN (");
 		q.add(subq.toString());
-		q.add(") subq USING (chat_id) WHERE account_id=? AND chat_id IN (");
+		q.add(") subq USING (chat_id) WHERE account_id=? AND stanza_id=correction_id AND chat_id IN (");
 		params.push(accountId);
 		for (i => chat in chats) {
 			if (i != 0) q.add(",");