Compare commits

...

1 Commits

Author SHA1 Message Date
Simon Laux
691cd99cdc fix: add ChatlistItemChanged event to
`on_archived_chats_maybe_noticed`

Also fixes duplicated events when marking archived link as noticed.
2026-01-14 18:59:28 +01:00

View File

@@ -3316,7 +3316,10 @@ pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()>
context.emit_event(EventType::MsgsNoticed(chat_id));
chatlist_events::emit_chatlist_item_changed(context, chat_id);
context.on_archived_chats_maybe_noticed();
if !chat_id.is_archived_link() {
// prevents event duplication when marking all archived chats as noticed
context.on_archived_chats_maybe_noticed();
}
Ok(())
}
@@ -5110,12 +5113,14 @@ impl Context {
}
}
/// Emits the appropriate `MsgsChanged` event. Should be called if the number of unnoticed
/// Emits the appropriate `MsgsChanged` and `ChatlistItemChanged` event.
/// Should be called if the number of unnoticed
/// archived chats could decrease. In general we don't want to make an extra db query to know if
/// a noticed chat is archived. Emitting events should be cheap, a false-positive `MsgsChanged`
/// is ok.
pub(crate) fn on_archived_chats_maybe_noticed(&self) {
self.emit_msgs_changed_without_msg_id(DC_CHAT_ID_ARCHIVED_LINK);
chatlist_events::emit_chatlist_item_changed(self, DC_CHAT_ID_ARCHIVED_LINK);
}
}