mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
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:
@@ -389,11 +389,15 @@ impl ChatId {
|
|||||||
let threshold_timestamp = time() - delete_device_after;
|
let threshold_timestamp = time() - delete_device_after;
|
||||||
|
|
||||||
// Hide expired messages
|
// 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(
|
let rows_modified = context.sql.execute(
|
||||||
"UPDATE msgs \
|
"UPDATE msgs \
|
||||||
SET txt = 'DELETED', hidden = 1 \
|
SET txt = 'DELETED', hidden = 1 \
|
||||||
WHERE timestamp < ? \
|
WHERE timestamp < ? \
|
||||||
AND chat_id == ?",
|
AND chat_id == ? \
|
||||||
|
AND NOT hidden",
|
||||||
params![threshold_timestamp, self],
|
params![threshold_timestamp, self],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user