refactor(#2629): fix stale self-filter doc comments + flatten the sender-check let-chain

This commit is contained in:
damocles 2026-07-22 17:51:34 +02:00
commit b68d91269f
2 changed files with 17 additions and 10 deletions

View file

@ -903,12 +903,15 @@ pub async fn collect_unread_with_ids(
} else {
(None, None)
};
// Skip rooms where the newest unread event was sent by the agent itself.
// Self-authored messages should not trigger an unread notification.
if let (Some(ref sender), Some(own_id)) = (&last_sender, own_user_id) {
if sender == own_id.as_str() {
continue;
}
// Skip a single-unread room whose newest event is the agent's own
// message: after a rebuild the read receipt may not have advanced
// past it yet, so `notification_count` can still report 1 — without
// this the agent self-wakes on its own message. Only reachable on the
// count==1 path, where `last_sender` is populated.
if let (Some(sender), Some(own_id)) = (&last_sender, own_user_id)
&& sender.as_str() == own_id.as_str()
{
continue;
}
result.push((
room.room_id().to_owned(),