From 0f0b01283156ec80ab4cedce35e3265eaa4fb415 Mon Sep 17 00:00:00 2001 From: iequidoo Date: Tue, 20 Jan 2026 18:22:12 -0300 Subject: [PATCH] fix: Emit MsgsChanged instead of MsgsNoticed on self-MDN if chat still has fresh messages Otherwise if the user reads messages being offline and then the device comes online, sent MDNs will remove all notifications from other devices even if new messages have arrived. Notifications not removed at all look more acceptable. --- src/receive_imf.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index 9910859f61..ea5dac92b5 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -1017,12 +1017,12 @@ UPDATE msgs SET state=? WHERE ) .await .context("UPDATE msgs.state")?; - // Removes all notifications for the chat in UIs. Ideally should be under - // `if chat_id.get_fresh_msg_cnt(context).await? == 0`, but this causes a not - // updated profile badge counter in the UIs as of v2.35.0. Removed notifications for - // new messages is an already existing and known problem, so let's emit the event - // unconditionally for now. - context.emit_event(EventType::MsgsNoticed(chat_id)); + if chat_id.get_fresh_msg_cnt(context).await? == 0 { + // Removes all notifications for the chat in UIs. + context.emit_event(EventType::MsgsNoticed(chat_id)); + } else { + context.emit_msgs_changed_without_msg_id(chat_id); + } chatlist_events::emit_chatlist_item_changed(context, chat_id); } if archived_chats_maybe_noticed {