feat: Simplify message query conditions in DialogDao for improved clarity and performance

This commit is contained in:
k1ngsterr1
2026-01-18 23:15:12 +05:00
parent 6b839d2729
commit 8bc1eecf10

View File

@@ -550,8 +550,8 @@ interface DialogDao {
(SELECT delivered FROM messages (SELECT delivered FROM messages
WHERE account = :account WHERE account = :account
AND from_me = 1 AND from_me = 1
AND ((from_public_key = :opponentKey AND to_public_key = :account) AND from_public_key = :account
OR (from_public_key = :account AND to_public_key = :opponentKey)) AND to_public_key = :opponentKey
ORDER BY timestamp DESC LIMIT 1), ORDER BY timestamp DESC LIMIT 1),
0 0
) AS last_message_delivered, ) AS last_message_delivered,
@@ -559,8 +559,8 @@ interface DialogDao {
(SELECT read FROM messages (SELECT read FROM messages
WHERE account = :account WHERE account = :account
AND from_me = 1 AND from_me = 1
AND ((from_public_key = :opponentKey AND to_public_key = :account) AND from_public_key = :account
OR (from_public_key = :account AND to_public_key = :opponentKey)) AND to_public_key = :opponentKey
ORDER BY timestamp DESC LIMIT 1), ORDER BY timestamp DESC LIMIT 1),
0 0
) AS last_message_read ) AS last_message_read