mirror of
https://github.com/chatmail/core.git
synced 2026-10-02 03:00:40 +03:00
fix: take timestamp_rcvd into account in estimate_deletion_cnt
This did not affect actual message deletion, because select_expired_messages already takes timestamp_rcvd into account and does not delete system messages that say "Messages are end-to-end encrypted" too early. So it is a minor bug as estimate_deletion_cnt is meant to only roughly estimate the number of messages to be deleted. Still, there were no tests before, so now estimate_deletion_cnt is tested.
This commit is contained in:
+5
-4
@@ -2100,10 +2100,11 @@ pub async fn estimate_deletion_cnt(
|
||||
.count(
|
||||
"SELECT COUNT(*)
|
||||
FROM msgs m
|
||||
WHERE m.id > ?
|
||||
AND timestamp < ?
|
||||
AND chat_id != ?
|
||||
AND chat_id != ? AND hidden = 0;",
|
||||
WHERE m.id > ?1
|
||||
AND timestamp < ?2 -- Sorting timestamp may be 0 for system messages
|
||||
AND timestamp_rcvd < ?2 -- so we check 'received' timestamp as well.
|
||||
AND chat_id != ?3
|
||||
AND chat_id != ?4 AND hidden = 0;",
|
||||
(
|
||||
DC_MSG_ID_LAST_SPECIAL,
|
||||
threshold_timestamp,
|
||||
|
||||
Reference in New Issue
Block a user