From f5e1dd2cbef090d617528a4ad9416ede66772d9a Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 13:30:56 -0400 Subject: [PATCH] LR-LIB-ALBUM: album.toggleTarget reports toggled: 0 when no photo is left to toggle The command description lists toggled in every result; the early return left it out, so a client read null instead of 0. --- crates/engine/src/cmd/library/specs.rs | 2 +- crates/engine/src/tests/album_missing.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/library/specs.rs b/crates/engine/src/cmd/library/specs.rs index df54d9162..0dcbefe19 100644 --- a/crates/engine/src/cmd/library/specs.rs +++ b/crates/engine/src/cmd/library/specs.rs @@ -1076,7 +1076,7 @@ pub fn specs() -> Vec { .or_else(|| s.catalog.quick_collection()); let al = existing.and_then(|a| s.catalog.album(a)); return Ok( - json!({"album": al.map(|a| a.id.0), "name": al.map(|a| a.name.clone()), "added": null, "count": al.map_or(0, |a| s.catalog.album_count(a.id)), "skipped": skipped}), + json!({"album": al.map(|a| a.id.0), "name": al.map(|a| a.name.clone()), "added": null, "toggled": 0, "count": al.map_or(0, |a| s.catalog.album_count(a.id)), "skipped": skipped}), ); } let target = s.target_album.filter(|a| s.catalog.album(*a).is_some_and(|al| !al.is_smart() && !al.folder)); diff --git a/crates/engine/src/tests/album_missing.rs b/crates/engine/src/tests/album_missing.rs index 016f7e3df..560e2074c 100644 --- a/crates/engine/src/tests/album_missing.rs +++ b/crates/engine/src/tests/album_missing.rs @@ -49,7 +49,7 @@ fn photos_the_catalog_lacks_reach_no_album() { // toggling: nothing is made or changed for ids that are gone let r = s.execute("album.toggleTarget", &json!({"ids": [GONE.0]})).unwrap(); - assert!(r["added"].is_null(), "{r}"); + assert!(r["added"].is_null() && r["toggled"] == 0, "{r}"); assert!(s.catalog.quick_collection().is_none(), "no Quick Collection for nothing"); assert_eq!(s.undo.len(), undo + 1); @@ -78,7 +78,7 @@ fn toggling_gone_photos_leaves_the_target_album_and_redo_alone() { let undo = s.undo.len(); let r = s.execute("album.toggleTarget", &json!({"ids": [GONE.0]})).unwrap(); assert_eq!(r["album"].as_u64(), Some(a.0), "{r}"); - assert!(r["added"].is_null(), "{r}"); + assert!(r["added"].is_null() && r["toggled"] == 0, "{r}"); assert_eq!(s.catalog.album(a).unwrap().photos, vec![photo]); assert_eq!((s.undo.len(), s.redo.len()), (undo, 1)); }