mirror of
https://github.com/storytold/lightcraft.git
synced 2026-11-01 05:57:09 -06:00
Enable Filters: a folder in the filter follows a move with filters on too (follow-up to #2709)
This commit is contained in:
@@ -482,6 +482,7 @@ pub(crate) fn follow_folder(s: &mut Session, from: &str, to: &str) {
|
||||
// a library folder chosen at or below it follows too, as a source or as a filter
|
||||
follow_library_folder(&mut s.library_folder, from, to);
|
||||
follow_library_folder(&mut s.filter.library_folder, from, to);
|
||||
follow_library_folder(&mut s.filter.folder, from, to);
|
||||
if let Some(f) = s.shelved_filter.as_mut() {
|
||||
follow_library_folder(&mut f.library_folder, from, to);
|
||||
follow_library_folder(&mut f.folder, from, to);
|
||||
|
||||
@@ -52,6 +52,20 @@ fn a_folder_in_the_filter_put_aside_follows_a_move() {
|
||||
assert_eq!(s.visible().len(), 1, "the moved photo, as before the move");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_folder_in_the_filter_follows_a_move_with_filters_on() {
|
||||
let dir = Scratch::new("live");
|
||||
let (trip, archive) = (dir.path("trip"), dir.path("archive"));
|
||||
let mut s = Session::new();
|
||||
add(&mut s, &format!("{trip}/a.jpg"), 0);
|
||||
add(&mut s, &dir.path("elsewhere.jpg"), 0);
|
||||
s.execute("library.filter", &json!({"folder": trip})).unwrap();
|
||||
assert_eq!(s.visible().len(), 1, "the filter hides a photo, or a stale folder would look alike");
|
||||
s.execute("folder.move", &json!({"path": trip, "into": archive})).unwrap();
|
||||
assert_eq!(s.filter.folder.as_deref(), Some(dir.path("archive/trip").as_str()), "the folder where it went");
|
||||
assert_eq!(s.visible().len(), 1, "the moved photo, as before the move");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn moving_the_browsed_folder_while_off_brings_back_the_filter_put_aside() {
|
||||
let dir = Scratch::new("browse");
|
||||
|
||||
Reference in New Issue
Block a user