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
@@ -167,6 +167,21 @@ public class SettingsModalViewModelTests : IDisposable
Assert.True(vm.HasLinkedRepo);
}
[Fact]
public async Task HasLinkedRepo_false_when_a_list_working_dir_is_whitespace_only()
{
using (var ctx = NewContext())
{
ctx.Lists.Add(new ListEntity { Id = "l1", Name = "Blank repo", CreatedAt = DateTime.UtcNow, WorkingDir = " " });
ctx.SaveChanges();
}
var vm = MakeVm(new FakeWorker());
await vm.LoadAsync();
Assert.False(vm.HasLinkedRepo);
}
[Fact]
public void SelectedCategory_updates_SelectedIndex_and_ignores_null()
{