refactor(ui): unify list-linked-repo predicate into RepoLinkage

ListsIslandViewModel and SettingsModalViewModel each re-implemented "does
this list have a linked WorkingDir" with different whitespace handling.
RepoLinkage.IsLinked/IsLinkedInDb is now the single definition; both
callers derive from it, closing the whitespace-only WorkingDir gap where
the Settings modal disagreed with the ListsIsland banner.
This commit is contained in:
Mika Kuns
2026-08-24 09:28:20 +02:00
parent 29171b104b
commit 9578c95074
4 changed files with 42 additions and 4 deletions
@@ -56,6 +56,8 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
// True once at least one list has a linked repo (WorkingDir). Drives the repo-hint strip on
// Worktrees/Prime Claude/Session Skills/Berichte — nothing is ever hidden, just annotated.
// Scope intentionally broader than ListsIslandViewModel.HasNoLinkedRepo (all Lists rows in
// the DB, not just UserLists).
[ObservableProperty] private bool _hasLinkedRepo;
// Wired by WindowDialogService to close this modal and open the existing repo-import flow.
@@ -152,7 +154,7 @@ public sealed partial class SettingsModalViewModel : ViewModelBase
General.LoadModelPresets(dto?.ModelPresets, General.MaxTurnsCeiling);
await using var ctx = await _dbFactory.CreateDbContextAsync();
HasLinkedRepo = await ctx.Lists.AnyAsync(l => l.WorkingDir != null && l.WorkingDir != "");
HasLinkedRepo = await ctx.Lists.AnyAsync(RepoLinkage.IsLinkedInDb);
}
finally { IsBusy = false; }
}