Add oneliner to case view

Introduce an `oneliner` field to the `CaseView` struct and update the
`scan_cases` function to read it from `oneliner.txt`. The `cases.html`
template is updated to display the oneliner if present. A new
integration test is added to verify the functionality.
This commit is contained in:
2026-04-13 19:23:35 +02:00
parent 33da841087
commit d3ef78796d
3 changed files with 21 additions and 0 deletions
+7
View File
@@ -22,6 +22,7 @@ struct CaseView {
case_id_short: String,
status: String,
most_recent: String,
oneliner: Option<String>,
recordings: Vec<RecordingView>,
}
@@ -141,6 +142,11 @@ async fn scan_cases(data_path: &Path) -> Vec<CaseView> {
.map(|r| r.filename.clone())
.unwrap_or_default();
let case_id_short = case_id.chars().take(8).collect();
let oneliner = tokio::fs::read_to_string(case_entry.path().join("oneliner.txt"))
.await
.ok()
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty());
cases.push(CaseView {
user_slug: user_slug.clone(),
@@ -148,6 +154,7 @@ async fn scan_cases(data_path: &Path) -> Vec<CaseView> {
case_id_short,
status: status.to_string(),
most_recent,
oneliner,
recordings,
});
}