From f912d18dea9a03becf869f688ca6534da8acccac Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sun, 25 Oct 2026 03:50:40 -0400 Subject: [PATCH] LRC-LIB-LIBFOLDERS: Don't ask again is kept only when a photo moved --- crates/ui-egui/src/dialogs/confirm.rs | 5 +++-- crates/ui-egui/src/tests/folder_drop.rs | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs/confirm.rs b/crates/ui-egui/src/dialogs/confirm.rs index 3b13bedbd..848ecf326 100644 --- a/crates/ui-egui/src/dialogs/confirm.rs +++ b/crates/ui-egui/src/dialogs/confirm.rs @@ -213,8 +213,9 @@ pub fn confirm_dialog(app: &mut LightcraftApp, dlg: &Dialog) -> Result 0 { app.ui.settings.ask_before_move = false; } Ok(json!({"moved": moved})) diff --git a/crates/ui-egui/src/tests/folder_drop.rs b/crates/ui-egui/src/tests/folder_drop.rs index c45c37640..438e035d6 100644 --- a/crates/ui-egui/src/tests/folder_drop.rs +++ b/crates/ui-egui/src/tests/folder_drop.rs @@ -347,6 +347,27 @@ fn dont_ask_again_is_kept_only_when_the_move_began() { let _ = std::fs::remove_dir_all(&root); } +/// A confirmation that finds the photos in the folder already (they were moved there while the question was +/// open, or a folder synchronization relinked them) moves nothing, so it doesn't turn the question off either. +#[test] +fn dont_ask_again_is_kept_only_when_a_photo_moved() { + let (root, trip, home) = folders("dont-ask-already"); + let mut h = app(&[(trip.join("beach.png"), false), (home.join("garden.png"), false)]); + click(&mut h, &format!("libraryFolderToggle:{}", folder_key(&root))); + let target = folder_row(&h, &home).unwrap(); + let beach = id_of(&h, "beach.png"); + drop_beach(&mut h, beach, target); + click(&mut h, "check:moveDontAsk"); + assert!(matches!(h.app.ui.dialog, Some(crate::state::Dialog::MovePhotos { dont_ask: true, .. })), "ticked"); + // the photo gets there some other way while the question is open + h.app.run("photo.moveToFolder", json!({"folder": home.to_string_lossy(), "ids": [beach]})).unwrap(); + assert!(home.join("beach.png").is_file()); + click(&mut h, "button:dialogOk"); + assert!(h.app.ui.dialog.is_none()); + assert!(h.app.ui.settings.ask_before_move, "nothing moved: the question stays on"); + let _ = std::fs::remove_dir_all(&root); +} + #[test] fn a_question_left_open_while_another_library_opens_moves_nothing() { let (root, trip, home) = folders("other-library");