Mark all read on an OPML subscription

Marking the subscription read did nothing: its own row holds no entries.
read-all now resolves the feeds grouped under the id -- via
subscriptions(), so a child promoted to config is included -- and marks
those. Button sits before Unsubscribe, where every other feed keeps it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AdXho5tTkjFLeUXKbEjKBh
This commit is contained in:
2026-09-10 18:45:46 +00:00
parent 8f5e2749ff
commit 7473d5b7fb
5 changed files with 46 additions and 4 deletions

View File

@@ -660,7 +660,15 @@ async fn read_all(
State(state): State<WebState>,
Path(id): Path<String>,
) -> Result<Json<serde_json::Value>, ApiError> {
let n = state.ctx.db.mark_all_read(&id)?;
// A subscription's own row has no entries, so marking it read means everything under it.
let mut ids = vec![id.clone()];
ids.extend(
crate::subscriptions(&state.ctx)?
.into_iter()
.filter(|s| s.cfg.group.as_deref() == Some(id.as_str()))
.map(|s| s.id),
);
let n = state.ctx.db.mark_all_read(&ids)?;
Ok(Json(serde_json::json!({ "marked": n })))
}