From 9be871ccf6dcf09fda76bf4dada94b72f7426348 Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 5 Jun 2023 12:11:03 +0000 Subject: [PATCH] fix: emit DC_EVENT_MSGS_CHANGED without IDs when the message expires Specifying msg IDs that cannot be loaded in the event payload results in an error when the UI tries to load the message. Instead, emit an event without IDs to make the UI reload the whole messagelist. --- src/ephemeral.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 22c3b6303..0ccd17d26 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -429,7 +429,7 @@ pub(crate) async fn delete_expired_messages(context: &Context, now: i64) -> Resu if !rows.is_empty() { info!(context, "Attempting to delete {} messages.", rows.len()); - let (msgs_changed, webxdc_deleted) = context + let (_msgs_changed, webxdc_deleted) = context .sql .transaction(|transaction| { let mut msgs_changed = Vec::with_capacity(rows.len()); @@ -455,9 +455,7 @@ pub(crate) async fn delete_expired_messages(context: &Context, now: i64) -> Resu }) .await?; - for (chat_id, msg_id) in msgs_changed { - context.emit_msgs_changed(chat_id, msg_id); - } + context.emit_msgs_changed_without_ids(); for msg_id in webxdc_deleted { context.emit_event(EventType::WebxdcInstanceDeleted { msg_id });