diff --git a/CHANGELOG.md b/CHANGELOG.md index 942ac2a86..b754ae5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Changes +- Only send IncomingMsgBunch if there are more than 0 new messages #3941 ### API-Changes diff --git a/src/imap.rs b/src/imap.rs index 94d4223d2..8bf71b4c3 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -828,11 +828,13 @@ impl Imap { info!(context, "{} mails read from \"{}\".", read_cnt, folder); - let msg_ids = received_msgs + let msg_ids: Vec = received_msgs .iter() .flat_map(|m| m.msg_ids.clone()) .collect(); - context.emit_event(EventType::IncomingMsgBunch { msg_ids }); + if !msg_ids.is_empty() { + context.emit_event(EventType::IncomingMsgBunch { msg_ids }); + } chat::mark_old_messages_as_noticed(context, received_msgs).await?;