Merge: origin's sync ordering and adoption work, its scan-complete trigger ported into library_ui/

This commit is contained in:
2026-09-21 11:32:05 +02:00
13 changed files with 432 additions and 43 deletions
+21 -4
View File
@@ -49,8 +49,11 @@ fn spawn_scheduled_backup(ctl: &Rc<LibraryController>) {
/// Push shards and the catalog to the server, and take what it has.
///
/// Fired after the sweep completes, when there is a finished index worth
/// sharing, and from the Sync button for an explicit exchange.
/// Fired when the scan completes, so a fresh device inherits its peers'
/// work before deriving any of its own; after the sweep completes, when
/// there is a finished index worth sharing; and from the Sync button for an
/// explicit exchange. A pass still running when the next trigger fires is
/// left to finish — the guard below.
pub(super) fn start_derived_sync(window: &AppWindow, ctl: &Rc<LibraryController>) {
// An escape hatch for running the app against a *copied* library without
// touching the account's real server.
@@ -174,7 +177,7 @@ pub(super) fn start_derived_sync(window: &AppWindow, ctl: &Rc<LibraryController>
crate::derived_sync::SyncMessage::Finished(report) => {
log::info!(
"sync: {} shard(s) up, {} down ({} thumbnails), \
catalog {}{}",
catalog {}{}{}",
report.shards_uploaded,
report.shards_downloaded,
report.thumbnails_adopted,
@@ -191,6 +194,11 @@ pub(super) fn start_derived_sync(window: &AppWindow, ctl: &Rc<LibraryController>
format!(", {} collection(s) gained", report.collections_gained)
} else {
String::new()
},
if report.dates_gained > 0 {
format!(", {} date(s) gained", report.dates_gained)
} else {
String::new()
}
);
w.global::<Library>().set_library_syncing(false);
@@ -208,13 +216,22 @@ pub(super) fn start_derived_sync(window: &AppWindow, ctl: &Rc<LibraryController>
.set_library_status(format!("synced · {summary}").into());
}
// Adopted thumbnails and merged collections both change
// what the grid should show.
// what the grid should show; adopted dates change its
// order, and the timeline beside it.
if report.thumbnails_adopted > 0
|| report.collections_gained > 0
|| report.members_gained > 0
|| report.dates_gained > 0
{
load_window(&w, &ctl_cb);
}
if report.dates_gained > 0 {
let borrow = ctl_cb.catalog();
let borrow = borrow.borrow();
if let Some(cat) = borrow.as_ref() {
refresh_timeline(&w, cat, &ctl_cb);
}
}
// TRACES: FR-CAT-7
// And the sidebar, which the grid reload does not
// touch. Membership counts as a change: a sync that