From 8ca820b05e9e699a7b563a2e37ff2a0629a5505a Mon Sep 17 00:00:00 2001 From: Doot Agent Date: Sun, 5 Jul 2026 08:22:17 +0000 Subject: fix: native tasks missing from Tasks tab and blank title on completion Bug 1: BuildUnifiedAtomList never called GetNativeTasks(), so doot-sourced tasks were absent from the web Tasks tab. Added GetNativeTasks() fetch and NativeTaskToAtom conversion (new model helper, SourceDoot constant). Bug 2: handleAtomToggle called getAtomDetails after CompleteNativeTask, but GetNativeTasks filters WHERE completed=0, so the task was already gone and the title came back blank. Moved getAtomDetails call to before the completion switch so all sources (including doot) capture title/dueDate first. Also fixed widget_test.go compile error: TestHandleWidgetComplete_NonTodoist called HandleWidgetComplete as a package-level function but it is a method on *Handler. Rewrote the file as package handlers (internal) and construct &Handler{} directly. Regression tests added for both bugs in atoms_test.go and handlers_test.go. Co-Authored-By: Claude Sonnet 4.6 --- internal/models/atom.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'internal/models/atom.go') diff --git a/internal/models/atom.go b/internal/models/atom.go index 3d9ce54..967b489 100644 --- a/internal/models/atom.go +++ b/internal/models/atom.go @@ -14,6 +14,7 @@ const ( SourceMeal AtomSource = "plantoeat" SourceGTasks AtomSource = "gtasks" SourceClaudomator AtomSource = "claudomator" + SourceDoot AtomSource = "doot" ) type AtomType string @@ -102,6 +103,31 @@ func TaskToAtom(t Task) Atom { } } +// NativeTaskToAtom converts a native doot Task to an Atom. +func NativeTaskToAtom(t Task) Atom { + priority := t.Priority + if priority < 1 { + priority = 1 + } + if priority > 4 { + priority = 4 + } + + return Atom{ + ID: t.ID, + Title: t.Content, + Description: t.Description, + Source: SourceDoot, + Type: TypeTask, + DueDate: t.DueDate, + CreatedAt: t.CreatedAt, + Priority: priority, + SourceIcon: "✅", + ColorClass: "border-green-500", + Raw: t, + } +} + // CardToAtom converts a Trello Card to an Atom func CardToAtom(c Card) Atom { // Trello doesn't have explicit priority, default to medium (2) -- cgit v1.2.3