Do not hide hidden messages in ChatId.delete_device_expired_messages()

This prevents infinite event loop, when chatlist is reloaded in response
to event, and event is emitted by hiding messages before chatlist reload.
This commit is contained in:
Alexander Krotov
2020-03-28 22:09:06 +03:00
parent 3686048ab6
commit 237dabb907

View File

@@ -389,11 +389,15 @@ impl ChatId {
let threshold_timestamp = time() - delete_device_after;
// Hide expired messages
//
// Only update the rows that have to be updated, to avoid emitting
// unnecessary "chat modified" events.
let rows_modified = context.sql.execute(
"UPDATE msgs \
SET txt = 'DELETED', hidden = 1 \
WHERE timestamp < ? \
AND chat_id == ?",
AND chat_id == ? \
AND NOT hidden",
params![threshold_timestamp, self],
)?;