From 2bf4c5d7e7781007bfc65edc51cd95a570025fad Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 28 Mar 2020 20:13:17 +0300 Subject: [PATCH] Emit "chat modified" event when messages expire --- src/chat.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/chat.rs b/src/chat.rs index 990638a2e..69b8ca0ad 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -389,13 +389,17 @@ impl ChatId { let threshold_timestamp = time() - delete_device_after; // Hide expired messages - context.sql.execute( + let rows_modified = context.sql.execute( "UPDATE msgs \ SET txt = 'DELETED', hidden = 1 \ WHERE timestamp < ? \ AND chat_id == ?", params![threshold_timestamp, self], )?; + + if rows_modified > 0 { + context.call_cb(Event::ChatModified(self)); + } } Ok(()) }