matrix: drop dead unread_count handler

This commit is contained in:
damocles 2026-08-03 14:43:14 +02:00 committed by mara
commit 772529b7b5

View file

@ -901,28 +901,6 @@ pub async fn download_file(
}))
}
/// Return the number of joined rooms with at least one unread
/// notification according to the server-side push notification counts
/// cached by the matrix-sdk client.
///
/// The harness uses [`unread_summary`] (richer, with per-room body
/// snippets) rather than this endpoint. `unread_count` is kept as a
/// lightweight public endpoint for callers that only need the count
/// and want to avoid the `/messages` network round-trips that
/// [`collect_unread`] issues for count==1 rooms.
#[must_use]
pub fn unread_count(client: &Client) -> DaemonResponse {
let rooms = u32::try_from(
client
.joined_rooms()
.into_iter()
.filter(|r| r.unread_notification_counts().notification_count > 0)
.count(),
)
.unwrap_or(u32::MAX);
DaemonResponse::ok(&serde_json::json!({ "rooms": rooms }))
}
/// Collect all rooms with unread notifications and build per-room
/// [`crate::protocol::RoomUnread`] entries. For rooms with exactly
/// one unread notification the last message body is fetched via the