From 1ada978f9ebdbfe8af5c438e4279f273e138f9d7 Mon Sep 17 00:00:00 2001 From: Sandro Date: Sun, 25 Oct 2026 01:57:32 +0200 Subject: [PATCH] fix(triage): clean default blocks when converting thought/todo to workspace document --- internal/storage/sqlite.go | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/internal/storage/sqlite.go b/internal/storage/sqlite.go index 9e2074b..8c57d89 100644 --- a/internal/storage/sqlite.go +++ b/internal/storage/sqlite.go @@ -811,11 +811,33 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target if len(title) > 72 { title = title[:72] + "…" } - blocks := []domain.DocumentBlock{ - {ID: domain.NewID("blk"), Type: "callout", Content: "Ursprünglicher Gedanke aus deiner Inbox vom " + thought.CreatedAt[:10]}, - {ID: domain.NewID("blk"), Type: "paragraph", Content: thought.Content}, - {ID: domain.NewID("blk"), Type: "h2", Content: "Nächste Schritte"}, - {ID: domain.NewID("blk"), Type: "todo", Content: "Ersten Meilenstein definieren", Checked: false}, + blocks := make([]domain.DocumentBlock, 0) + if strings.TrimSpace(thought.Notes) != "" { + blocks = append(blocks, domain.DocumentBlock{ + ID: domain.NewID("blk"), + Type: "bullet", + Content: strings.TrimSpace(thought.Notes), + Level: 0, + }) + } + if len(thought.Subtasks) > 0 { + for _, st := range thought.Subtasks { + blocks = append(blocks, domain.DocumentBlock{ + ID: domain.NewID("blk"), + Type: "todo", + Content: st.Title, + Checked: st.IsCompleted, + Level: 0, + }) + } + } + if len(blocks) == 0 { + blocks = append(blocks, domain.DocumentBlock{ + ID: domain.NewID("blk"), + Type: "bullet", + Content: "", + Level: 0, + }) } doc, err := s.CreateDocument(userID, "", title, "📄", "", blocks, thought.Tags, false) if err == nil && doc != nil {