Hide folders holding only hidden versions from /photos dirs (#194)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cameron CordesandClaude Opus 5.5 committed 2026-10-30 19:24:22 -04:00
1 parent aefc4bc411
commit 0e1fdd43e5
3 files changed
+122

No files matched your search

+29
View File
@@ -433,6 +433,35 @@ async fn photos_hides_versions_and_adds_parallel_arrays() {
);
}
#[actix_rt::test]
async fn folders_holding_only_hidden_versions_are_left_out_of_dirs() {
let (fx, _o, _v1, _v2) = seeded();
// A second folder whose aiedits holds a version that is NOT hidden
// (its original isn't indexed), and a folder nothing is indexed under.
fx.put_png("2004/album_a/aiedits/lost.jpg.edit.png", None, 20);
std::fs::create_dir_all(fx.root.join("2004/not_indexed")).unwrap();
let app = photos_app!(fx);
let dirs = |body: &serde_json::Value| -> Vec<String> {
let mut d: Vec<String> = body["dirs"]
.as_array()
.unwrap()
.iter()
.map(|v| v.as_str().unwrap().to_string())
.collect();
d.sort();
d
};
let (_, body) = get_json!(app, "/photos?path=2004");
assert_eq!(dirs(&body), vec!["2004/album_a", "2004/not_indexed"]);
let (_, body) = get_json!(app, "/photos?path=2004&include_versions=true");
assert_eq!(
dirs(&body),
vec!["2004/aiedits", "2004/album_a", "2004/not_indexed"]
);
}
#[actix_rt::test]
async fn photos_without_versions_is_unchanged() {
let fx = fx();