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

@ -9,8 +9,10 @@
//!
//! Todo summaries stay short: `sweep_unread` pushes the per-room unread
//! summary (`wake::format_unread_summary`); the message stays unread
//! server-side so the agent fetches detail via `read_room`. Self-sent
//! messages never raise an unread notification, so they never wake.
//! server-side so the agent fetches detail via `read_room`. A self-authored
//! newest message can still read as unread after a rebuild (the read receipt
//! lags), so `collect_unread_with_ids` filters those rooms out — the agent
//! never wakes on its own message.
use std::collections::HashSet;
@ -33,8 +35,10 @@ use crate::{handlers, wake};
/// `Some(name)` only in multi-account mode, prepended so the agent knows
/// which account to `read_room` on.
///
/// Self-sent messages don't raise an unread notification server-side, so
/// no explicit self-filter is needed here.
/// Rooms whose newest unread event is the agent's own message are filtered
/// out by `collect_unread_with_ids` (after a rebuild a stale read receipt can
/// otherwise leave a self-authored message counted as unread and self-wake
/// the agent).
pub async fn sweep_unread(
client: &Client,
notified: &Mutex<HashSet<OwnedRoomId>>,