From 73d7aff4248a5ab05cec55dbd7feb0d17b97c1df Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 19 Oct 2026 09:16:16 +0200 Subject: feat(notify): make the queue and history caps settable A lowered cap applies at the next add rather than at once, so reloading the config never drops a notification the user has not seen. Co-Authored-By: Claude Opus 5.5 --- internal/notify/store_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'internal/notify/store_test.go') diff --git a/internal/notify/store_test.go b/internal/notify/store_test.go index 13f78dc..cc351be 100644 --- a/internal/notify/store_test.go +++ b/internal/notify/store_test.go @@ -164,3 +164,26 @@ func TestStoreRemovesImageOnReplace(t *testing.T) { t.Fatalf("replace removed %v", removed) } } + +func TestSetCapsAppliesAtNextAdd(t *testing.T) { + s, _ := newTestStore() + for i := 0; i < 5; i++ { + id, _ := s.Add(popup("a"), "", 0) + s.Dismiss(id, 2) + } + for i := 0; i < 4; i++ { + s.Add(popup("a"), "", 0) + } + s.SetCaps(2, 3) + // Lowering a cap drops nothing by itself. + if got := len(s.historySnapshot()); got != 5 { + t.Fatalf("history after SetCaps = %d, want 5", got) + } + s.Add(popup("a"), "", 0) + if got := len(s.order); got != 2 { + t.Errorf("live = %d, want 2", got) + } + if got := len(s.historySnapshot()); got != 3 { + t.Errorf("history = %d, want 3", got) + } +} -- cgit v1.2.3