fix(copies): close the owner review 6 gaps with tests
Photos not sent: automatic photos of an integrated pair that failed three times in a row are now told with an error toast that shows the row, and the row reads "not sent" with the last reason. The matches-found and linked toasts of background detections run from their Windows notification too. Maintenance now clears a merge's or an integration's journal whose job is done, cancelled, or deleted without a cancel and untouched for the history's days. Tests pin the matches jobs in the priority queue, the owner's defaults (ask always, union, copy across), the dialog starting from the settings, Choose each preselecting nothing, no automatic photos for a pair whose server copy is gone, the repair of a corrupt local frame by an Integrate, and the owner's whole scenario end to end against a real in-process server. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fe752a0a21
commit
d10577b175
18 files changed
+804
-11
No files matched your search
@@ -226,6 +226,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
if (_attached) return;
|
||||
_attached = true;
|
||||
Host.Changed += OnChanged;
|
||||
Host.PhotosNotSent += OnPhotosNotSent;
|
||||
Loc.CultureChanged += OnCultureChanged;
|
||||
if (_shell.Services.Jobs is { } jobs)
|
||||
{
|
||||
@@ -271,6 +272,7 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
if (!_attached) return;
|
||||
_attached = false;
|
||||
Host.Changed -= OnChanged;
|
||||
Host.PhotosNotSent -= OnPhotosNotSent;
|
||||
Loc.CultureChanged -= OnCultureChanged;
|
||||
if (_shell.Services.Jobs is { } jobs)
|
||||
{
|
||||
@@ -337,7 +339,8 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
|
||||
/// <summary>What the Matches list adds to the row of <paramref name="entry"/>: its pair and why Upload all left it out.</summary>
|
||||
private SyncMark Mark(SyncEntry entry) => entry.Local is { } local
|
||||
? new SyncMark(Copies.PairOf(local.Id), _skipped.TryGetValue(local.Id, out var why) ? why : null, _shell.Services.Server.Flow.Info?.Name)
|
||||
? new SyncMark(Copies.PairOf(local.Id), _skipped.TryGetValue(local.Id, out var why) ? why : null, _shell.Services.Server.Flow.Info?.Name,
|
||||
Host.PhotoFailures.TryGetValue(local.Id, out var failure) && failure.Count >= SyncAgent.NotSentAfter ? failure : null)
|
||||
: new SyncMark(Copies.PairOf(entry.Id), null, _shell.Services.Server.Flow.Info?.Name);
|
||||
|
||||
/// <summary>The rule of Upload all local (design §6.4): what it sends, and what it leaves out and why.</summary>
|
||||
@@ -550,6 +553,36 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
|
||||
|
||||
private void OnChanged() => Dispatch(() => _ = ReloadAsync());
|
||||
|
||||
private void OnPhotosNotSent(string server, Guid localId, AutoPhotoFailure failure) => Dispatch(() => _ = TellNotSentAsync(localId));
|
||||
|
||||
/// <summary>
|
||||
/// The new photos of an integrated pair failed to move by themselves three times in a row (design §6.1): "{title}: photos
|
||||
/// not sent" · Show, which shows the sequence's row (it reads "not sent", the reason in its tooltip).
|
||||
/// </summary>
|
||||
internal async Task TellNotSentAsync(Guid localId)
|
||||
{
|
||||
var title = _entries.FirstOrDefault(e => e.Local?.Id == localId)?.Title;
|
||||
if (title is null && _shell.Services.Database is { } db)
|
||||
{
|
||||
try
|
||||
{
|
||||
title = (await db.Sequences.GetAsync(localId))?.DisplayTitle;
|
||||
}
|
||||
catch (Data.DatabaseException ex)
|
||||
{
|
||||
Log.Warning("sync", "The sequence whose photos were not sent could not be read", ex);
|
||||
}
|
||||
}
|
||||
if (title is null) return;
|
||||
var shown = title;
|
||||
_shell.Notify(Loc.L("Server.Sync.NotSentToast", title), null, Loc.L("Server.Sync.Show"), Loc.L("Tooltips.Server.Sync.ShowNotSent"), () =>
|
||||
{
|
||||
_shell.Navigate(SectionKey.Server);
|
||||
ShowFilter(SyncFilter.All, shown);
|
||||
}, isError: true, runsFromNotification: true);
|
||||
await ReloadAsync();
|
||||
}
|
||||
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => Dispatch(() =>
|
||||
{
|
||||
foreach (var chip in _chips) chip.Relabel();
|
||||
|
||||
Reference in new issue
Block a user