fix(KB-124): resolve ntfy duplicate notifications and spec editor layout
- Fix duplicate ntfy.sh notifications on task merge events - Fix spec editor layout overflow in TaskDetailModal - Add regression test coverage for merge notifications - Add changeset for notification fix
This commit is contained in:
7
.changeset/fix-ntfy-duplicate-notifications.md
Normal file
7
.changeset/fix-ntfy-duplicate-notifications.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"@dustinbyrne/kb": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove duplicate ntfy notification on task merge
|
||||||
|
|
||||||
|
Previously, when a task was merged to main, two identical notifications were sent because both `task:moved` (to "done") and `task:merged` events triggered notifications. Now only the `task:merged` event sends the notification, eliminating the duplicate.
|
||||||
@@ -374,6 +374,39 @@ describe("NtfyNotifier", () => {
|
|||||||
expect(fetchMock).toHaveBeenCalledTimes(2);
|
expect(fetchMock).toHaveBeenCalledTimes(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("sends notification only once on merge when task:moved and task:merged both fire", async () => {
|
||||||
|
notifier = new NtfyNotifier(store);
|
||||||
|
await notifier.start();
|
||||||
|
|
||||||
|
const task = createTask("KB-001", "Test Task");
|
||||||
|
const mergeResult: MergeResult = {
|
||||||
|
task,
|
||||||
|
branch: "kb/kb-001",
|
||||||
|
merged: true,
|
||||||
|
worktreeRemoved: true,
|
||||||
|
branchDeleted: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
// completeTask() emits task:moved to done before task:merged
|
||||||
|
store.triggerTaskMoved(task, "in-review", "done");
|
||||||
|
store.triggerTaskMerged(mergeResult);
|
||||||
|
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 10));
|
||||||
|
|
||||||
|
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||||
|
expect(fetchMock).toHaveBeenCalledWith(
|
||||||
|
"https://ntfy.sh/test-topic",
|
||||||
|
expect.objectContaining({
|
||||||
|
method: "POST",
|
||||||
|
headers: expect.objectContaining({
|
||||||
|
"Title": "Task KB-001 merged",
|
||||||
|
"Priority": "default",
|
||||||
|
}),
|
||||||
|
body: 'Task "Test Task" has been merged to main',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("prevents duplicate task:merged events for the same task", async () => {
|
it("prevents duplicate task:merged events for the same task", async () => {
|
||||||
notifier = new NtfyNotifier(store);
|
notifier = new NtfyNotifier(store);
|
||||||
await notifier.start();
|
await notifier.start();
|
||||||
|
|||||||
Reference in New Issue
Block a user