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
@@ -187,12 +187,14 @@ public sealed partial class ListsIslandViewModel : ViewModelBase, IDisposable
[ObservableProperty] private ListNavItemViewModel? _selectedList;
/// <summary>True whenever no User list has a linked <c>WorkingDir</c> — drives the no-repo
/// banner. Smart/Virtual lists never count. Recomputed after every load and every
/// list CRUD / list-settings save; never persisted, no dismiss state.</summary>
/// banner. Smart/Virtual lists never count (scope intentionally narrower than
/// SettingsModalViewModel.HasLinkedRepo, which checks all Lists rows in the DB). Recomputed
/// after every load and every list CRUD / list-settings save; never persisted, no dismiss
/// state.</summary>
[ObservableProperty] private bool _hasNoLinkedRepo = true;
private void RecomputeHasNoLinkedRepo() =>
HasNoLinkedRepo = UserLists.All(r => string.IsNullOrWhiteSpace(r.WorkingDir));
HasNoLinkedRepo = UserLists.All(r => !RepoLinkage.IsLinked(r.WorkingDir));
public string UserName { get; } = Environment.UserName;
public string MachineName { get; } = Environment.MachineName;